eslint-plugin-jsdoc 56.1.2 → 57.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -11
- package/dist/cjs/index-cjs.d.ts +10 -0
- package/dist/cjs/iterateJsdoc.d.ts +21 -5
- package/dist/exportParser.cjs +0 -6
- package/dist/exportParser.cjs.map +1 -1
- package/dist/index-cjs.cjs +108 -3
- package/dist/index-cjs.cjs.map +1 -1
- package/dist/index-cjs.d.ts +10 -0
- package/dist/index-esm.cjs +36 -10
- package/dist/index-esm.cjs.map +1 -1
- package/dist/index-esm.d.ts +29 -3
- package/dist/index.cjs +142 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +39 -3
- package/dist/iterateJsdoc.cjs +14 -8
- package/dist/iterateJsdoc.cjs.map +1 -1
- package/dist/iterateJsdoc.d.ts +21 -5
- package/dist/jsdocUtils.cjs +0 -3
- package/dist/jsdocUtils.cjs.map +1 -1
- package/dist/rules/checkParamNames.cjs +1 -1
- package/dist/rules/checkParamNames.cjs.map +1 -1
- package/dist/rules/checkPropertyNames.cjs +1 -1
- package/dist/rules/checkPropertyNames.cjs.map +1 -1
- package/dist/rules/informativeDocs.cjs +0 -3
- package/dist/rules/informativeDocs.cjs.map +1 -1
- package/dist/rules/matchName.cjs +0 -1
- package/dist/rules/matchName.cjs.map +1 -1
- package/dist/rules/noMultiAsterisks.cjs +0 -2
- package/dist/rules/noMultiAsterisks.cjs.map +1 -1
- package/dist/rules/requireReturnsCheck.cjs +0 -2
- package/dist/rules/requireReturnsCheck.cjs.map +1 -1
- package/dist/rules/sortTags.cjs +0 -2
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules/tagLines.cjs +0 -2
- package/dist/rules/tagLines.cjs.map +1 -1
- package/package.json +2 -1
- package/src/exportParser.js +0 -6
- package/src/index-cjs.js +125 -0
- package/src/index-esm.js +43 -13
- package/src/index.js +165 -12
- package/src/iterateJsdoc.js +17 -8
- package/src/jsdocUtils.js +0 -3
- package/src/rules/checkParamNames.js +1 -1
- package/src/rules/checkPropertyNames.js +1 -1
- package/src/rules/informativeDocs.js +0 -3
- package/src/rules/matchName.js +0 -1
- package/src/rules/noMultiAsterisks.js +0 -1
- package/src/rules/requireReturnsCheck.js +0 -1
- package/src/rules/sortTags.js +0 -2
- package/src/rules/tagLines.js +0 -1
package/src/iterateJsdoc.js
CHANGED
|
@@ -543,8 +543,6 @@ const {
|
|
|
543
543
|
seedTokens,
|
|
544
544
|
} = util;
|
|
545
545
|
|
|
546
|
-
// todo: Change these `any` types once importing types properly.
|
|
547
|
-
|
|
548
546
|
/**
|
|
549
547
|
* Should use ESLint rule's typing.
|
|
550
548
|
* @typedef {import('eslint').Rule.RuleMetaData} EslintRuleMeta
|
|
@@ -1749,8 +1747,14 @@ const getUtils = (
|
|
|
1749
1747
|
* mode: import('./jsdocUtils.js').ParserMode,
|
|
1750
1748
|
* preferredTypes: PreferredTypes,
|
|
1751
1749
|
* structuredTags: StructuredTags,
|
|
1752
|
-
* [
|
|
1753
|
-
*
|
|
1750
|
+
* contexts?: Context[],
|
|
1751
|
+
* augmentsExtendsReplacesDocs?: boolean,
|
|
1752
|
+
* ignoreReplacesDocs?: boolean,
|
|
1753
|
+
* implementsReplacesDocs?: boolean,
|
|
1754
|
+
* overrideReplacesDocs?: boolean,
|
|
1755
|
+
* ignoreInternal?: boolean,
|
|
1756
|
+
* ignorePrivate?: boolean,
|
|
1757
|
+
* exemptDestructuredRootsFromChecks?: boolean,
|
|
1754
1758
|
* }} Settings
|
|
1755
1759
|
*/
|
|
1756
1760
|
|
|
@@ -1923,7 +1927,7 @@ const makeReport = (context, commentNode) => {
|
|
|
1923
1927
|
* settings: Settings,
|
|
1924
1928
|
* utils: BasicUtils,
|
|
1925
1929
|
* }
|
|
1926
|
-
* ) =>
|
|
1930
|
+
* ) => void } JsdocVisitorBasic
|
|
1927
1931
|
*/
|
|
1928
1932
|
/**
|
|
1929
1933
|
* @typedef {(
|
|
@@ -1948,7 +1952,7 @@ const makeReport = (context, commentNode) => {
|
|
|
1948
1952
|
* settings: Settings,
|
|
1949
1953
|
* utils: Utils,
|
|
1950
1954
|
* }
|
|
1951
|
-
* ) =>
|
|
1955
|
+
* ) => void } JsdocVisitor
|
|
1952
1956
|
*/
|
|
1953
1957
|
|
|
1954
1958
|
/**
|
|
@@ -2084,6 +2088,7 @@ const getIndentAndJSDoc = function (lines, jsdocNode) {
|
|
|
2084
2088
|
* @property {EslintRuleMeta} meta ESLint rule meta
|
|
2085
2089
|
* @property {import('./jsdocUtils.js').DefaultContexts} [contextDefaults] Any default contexts
|
|
2086
2090
|
* @property {true} [contextSelected] Whether to force a `contexts` check
|
|
2091
|
+
* @property {(context: import('eslint').Rule.RuleContext) => import('eslint').Rule.RuleContext} [modifyContext] Modify the rule's context object
|
|
2087
2092
|
* @property {true} [iterateAllJsdocs] Whether to iterate all JSDoc blocks by default
|
|
2088
2093
|
* regardless of context
|
|
2089
2094
|
* @property {true} [checkPrivate] Whether to check `@private` blocks (normally exempted)
|
|
@@ -2391,13 +2396,17 @@ export default function iterateJsdoc (iterator, ruleConfig) {
|
|
|
2391
2396
|
return {
|
|
2392
2397
|
/**
|
|
2393
2398
|
* The entrypoint for the JSDoc rule.
|
|
2394
|
-
* @param {import('eslint').Rule.RuleContext}
|
|
2399
|
+
* @param {import('eslint').Rule.RuleContext} ctx
|
|
2395
2400
|
* a reference to the context which hold all important information
|
|
2396
2401
|
* like settings and the sourcecode to check.
|
|
2397
2402
|
* @returns {import('eslint').Rule.RuleListener}
|
|
2398
2403
|
* a listener with parser callback function.
|
|
2399
2404
|
*/
|
|
2400
|
-
create (
|
|
2405
|
+
create (ctx) {
|
|
2406
|
+
const context = ruleConfig.modifyContext ?
|
|
2407
|
+
ruleConfig.modifyContext(ctx) :
|
|
2408
|
+
ctx;
|
|
2409
|
+
|
|
2401
2410
|
const settings = getSettings(context);
|
|
2402
2411
|
if (!settings) {
|
|
2403
2412
|
return {};
|
package/src/jsdocUtils.js
CHANGED
|
@@ -1289,9 +1289,7 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
|
|
|
1289
1289
|
hasNonFunctionYield(node.property, checkYieldReturnValue);
|
|
1290
1290
|
|
|
1291
1291
|
case 'ObjectExpression':
|
|
1292
|
-
/* eslint-disable no-fallthrough */
|
|
1293
1292
|
case 'ObjectPattern':
|
|
1294
|
-
/* eslint-enable no-fallthrough */
|
|
1295
1293
|
return node.properties.some((property) => {
|
|
1296
1294
|
return hasNonFunctionYield(property, checkYieldReturnValue);
|
|
1297
1295
|
});
|
|
@@ -1414,7 +1412,6 @@ const hasYieldValue = (node, checkYieldReturnValue) => {
|
|
|
1414
1412
|
* @param {boolean} [innerFunction]
|
|
1415
1413
|
* @returns {boolean}
|
|
1416
1414
|
*/
|
|
1417
|
-
// eslint-disable-next-line complexity
|
|
1418
1415
|
const hasThrowValue = (node, innerFunction) => {
|
|
1419
1416
|
if (!node) {
|
|
1420
1417
|
return false;
|
|
@@ -315,7 +315,7 @@ const validateParameterNames = (
|
|
|
315
315
|
* idx: import('../iterateJsdoc.js').Integer
|
|
316
316
|
* }[]} jsdocParameterNames
|
|
317
317
|
* @param {import('comment-parser').Block} jsdoc
|
|
318
|
-
* @param {
|
|
318
|
+
* @param {import('../iterateJsdoc.js').Report} report
|
|
319
319
|
* @returns {boolean}
|
|
320
320
|
*/
|
|
321
321
|
const validateParameterNamesDeep = (
|
|
@@ -51,7 +51,7 @@ const validatePropertyNames = (
|
|
|
51
51
|
* type: string;
|
|
52
52
|
* }[]} jsdocPropertyNames
|
|
53
53
|
* @param {import('comment-parser').Block} jsdoc
|
|
54
|
-
* @param {
|
|
54
|
+
* @param {import('../iterateJsdoc.js').Report} report
|
|
55
55
|
*/
|
|
56
56
|
const validatePropertyNamesDeep = (
|
|
57
57
|
targetTagName,
|
|
@@ -13,8 +13,6 @@ const defaultUselessWords = [
|
|
|
13
13
|
'a', 'an', 'i', 'in', 'of', 's', 'the',
|
|
14
14
|
];
|
|
15
15
|
|
|
16
|
-
/* eslint-disable complexity -- Temporary */
|
|
17
|
-
|
|
18
16
|
/**
|
|
19
17
|
* @param {import('eslint').Rule.Node|import('@typescript-eslint/types').TSESTree.Node|null|undefined} node
|
|
20
18
|
* @returns {string[]}
|
|
@@ -89,7 +87,6 @@ const getNamesFromNode = (node) => {
|
|
|
89
87
|
return [];
|
|
90
88
|
}
|
|
91
89
|
};
|
|
92
|
-
/* eslint-enable complexity -- Temporary */
|
|
93
90
|
|
|
94
91
|
export default iterateJsdoc(({
|
|
95
92
|
context,
|
package/src/rules/matchName.js
CHANGED
package/src/rules/sortTags.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import defaultTagOrder from '../defaultTagOrder.js';
|
|
2
2
|
import iterateJsdoc from '../iterateJsdoc.js';
|
|
3
3
|
|
|
4
|
-
// eslint-disable-next-line complexity -- Temporary
|
|
5
4
|
export default iterateJsdoc(({
|
|
6
5
|
context,
|
|
7
6
|
jsdoc,
|
|
@@ -330,7 +329,6 @@ export default iterateJsdoc(({
|
|
|
330
329
|
|
|
331
330
|
const ct = countTagEmptyLines(tag);
|
|
332
331
|
if (ct) {
|
|
333
|
-
// eslint-disable-next-line complexity -- Temporary
|
|
334
332
|
const fixer = () => {
|
|
335
333
|
let foundFirstTag = false;
|
|
336
334
|
|