UNPKG

eslint-plugin-jsdoc

Version:
1,314 lines (1,280 loc) 124 kB
export interface Rules { /** Checks that `@access` tags have a valid value. */ "jsdoc/check-access": []; /** Reports invalid alignment of JSDoc block asterisks. */ "jsdoc/check-alignment": | [] | [ { /** * Set to 0 if you wish to avoid the normal requirement for an inner indentation of * one space. Defaults to 1 (one space of normal inner indentation). */ innerIndent?: number; } ]; /** @deprecated - Use `getJsdocProcessorPlugin` processor; ensures that (JavaScript) samples within `@example` tags adhere to ESLint rules. */ "jsdoc/check-examples": | [] | [ { allowInlineConfig?: boolean; baseConfig?: { [k: string]: unknown; }; captionRequired?: boolean; checkDefaults?: boolean; checkEslintrc?: boolean; checkParams?: boolean; checkProperties?: boolean; configFile?: string; exampleCodeRegex?: string; matchingFileName?: string; matchingFileNameDefaults?: string; matchingFileNameParams?: string; matchingFileNameProperties?: string; noDefaultExampleRules?: boolean; paddedIndent?: number; rejectExampleCodeRegex?: string; reportUnusedDisableDirectives?: boolean; } ]; /** Reports invalid padding inside JSDoc blocks. */ "jsdoc/check-indentation": | [] | [ { /** * Array of tags (e.g., `['example', 'description']`) whose content will be * "hidden" from the `check-indentation` rule. Defaults to `['example']`. * * By default, the whole JSDoc block will be checked for invalid padding. * That would include `@example` blocks too, which can get in the way * of adding full, readable examples of code without ending up with multiple * linting issues. * * When disabled (by passing `excludeTags: []` option), the following code *will* * report a padding issue: * * ```js * /** * * @example * * anArray.filter((a) => { * * return a.b; * * }); * * / * ``` */ excludeTags?: string[]; } ]; /** Reports invalid alignment of JSDoc block lines. */ "jsdoc/check-line-alignment": | [] | ["always" | "never" | "any"] | [ "always" | "never" | "any", { /** * An object with any of the following spacing keys set to an integer. * If a spacing is not defined, it defaults to one. */ customSpacings?: { /** * Affects spacing after the asterisk (e.g., `* @param`) */ postDelimiter?: number; /** * Affects spacing after any hyphens in the description (e.g., `* @param {someType} name - A description`) */ postHyphen?: number; /** * Affects spacing after the name (e.g., `* @param {someType} name `) */ postName?: number; /** * Affects spacing after the tag (e.g., `* @param `) */ postTag?: number; /** * Affects spacing after the type (e.g., `* @param {someType} `) */ postType?: number; }; /** * Disables `wrapIndent`; existing wrap indentation is preserved without changes. */ disableWrapIndent?: boolean; /** * A boolean to determine whether to preserve the post-delimiter spacing of the * main description. If `false` or unset, will be set to a single space. */ preserveMainDescriptionPostDelimiter?: boolean; /** * Use this to change the tags which are sought for alignment changes. Defaults to an array of * `['param', 'arg', 'argument', 'property', 'prop', 'returns', 'return', 'template']`. */ tags?: string[]; /** * The indent that will be applied for tag text after the first line. * Default to the empty string (no indent). */ wrapIndent?: string; } ]; /** Checks for dupe `@param` names, that nested param names have roots, and that parameter names in function declarations match JSDoc param names. */ "jsdoc/check-param-names": | [] | [ { /** * If set to `true`, this option will allow extra `@param` definitions (e.g., * representing future expected or virtual params) to be present without needing * their presence within the function signature. Other inconsistencies between * `@param`'s and present function parameters will still be reported. */ allowExtraTrailingParamDocs?: boolean; /** * Whether to check destructured properties. Defaults to `true`. */ checkDestructured?: boolean; /** * If set to `true`, will require that rest properties are documented and * that any extraneous properties (which may have been within the rest property) * are documented. Defaults to `false`. */ checkRestProperty?: boolean; /** * Defines a regular expression pattern to indicate which types should be * checked for destructured content (and that those not matched should not * be checked). * * When one specifies a type, unless it is of a generic type, like `object` * or `array`, it may be considered unnecessary to have that object's * destructured components required, especially where generated docs will * link back to the specified type. For example: * * ```js * /** * * @param {SVGRect} bbox - a SVGRect * * / * export const bboxToObj = function ({x, y, width, height}) { * return {x, y, width, height}; * }; * ``` * * By default `checkTypesPattern` is set to * `/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/v`, * meaning that destructuring will be required only if the type of the `@param` * (the text between curly brackets) is a match for "Object" or "Array" (with or * without initial caps), "PlainObject", or "GenericObject", "GenericArray" (or * if no type is present). So in the above example, the lack of a match will * mean that no complaint will be given about the undocumented destructured * parameters. * * Note that the `/` delimiters are optional, but necessary to add flags. * * Defaults to using (only) the `v` flag, so to add your own flags, encapsulate * your expression as a string, but like a literal, e.g., `/^object$/vi`. * * You could set this regular expression to a more expansive list, or you * could restrict it such that even types matching those strings would not * need destructuring. */ checkTypesPattern?: string; /** * Whether to check for extra destructured properties. Defaults to `false`. Change * to `true` if you want to be able to document properties which are not actually * destructured. Keep as `false` if you expect properties to be documented in * their own types. Note that extra properties will always be reported if another * item at the same level is destructured as destructuring will prevent other * access and this option is only intended to permit documenting extra properties * that are available and actually used in the function. */ disableExtraPropertyReporting?: boolean; /** * Whether to avoid checks for missing `@param` definitions. Defaults to `false`. Change to `true` if you want to be able to omit properties. */ disableMissingParamChecks?: boolean; /** * Set to `true` to auto-remove `@param` duplicates (based on identical * names). * * Note that this option will remove duplicates of the same name even if * the definitions do not match in other ways (e.g., the second param will * be removed even if it has a different type or description). */ enableFixer?: boolean; /** * Set to `true` if you wish to avoid reporting of child property documentation * where instead of destructuring, a whole plain object is supplied as default * value but you wish its keys to be considered as signalling that the properties * are present and can therefore be documented. Defaults to `false`. */ useDefaultObjectProperties?: boolean; } ]; /** Ensures that property names in JSDoc are not duplicated on the same block and that nested properties have defined roots. */ "jsdoc/check-property-names": | [] | [ { /** * Set to `true` to auto-remove `@property` duplicates (based on * identical names). * * Note that this option will remove duplicates of the same name even if * the definitions do not match in other ways (e.g., the second property will * be removed even if it has a different type or description). */ enableFixer?: boolean; } ]; /** Reports against syntax not valid for the mode (e.g., Google Closure Compiler in non-Closure mode). */ "jsdoc/check-syntax": []; /** Reports invalid block tag names. */ "jsdoc/check-tag-names": | [] | [ { /** * Use an array of `definedTags` strings to configure additional, allowed tags. * The format is as follows: * * ```json * { * "definedTags": ["note", "record"] * } * ``` */ definedTags?: string[]; /** * Set to `false` to disable auto-removal of types that are redundant with the [`typed` option](#typed). */ enableFixer?: boolean; /** * List of tags to allow inline. * * Defaults to array of `'link', 'linkcode', 'linkplain', 'tutorial'` */ inlineTags?: string[]; /** * If this is set to `true`, all of the following tags used to control JSX output are allowed: * * ``` * jsx * jsxFrag * jsxImportSource * jsxRuntime * ``` * * For more information, see the [babel documentation](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx). */ jsxTags?: boolean; /** * If this is set to `true`, additionally checks for tag names that are redundant when using a type checker such as TypeScript. * * These tags are always unnecessary when using TypeScript or similar: * * ``` * augments * callback * class * enum * implements * private * property * protected * public * readonly * this * type * typedef * ``` * * These tags are unnecessary except when inside a TypeScript `declare` context: * * ``` * abstract * access * class * constant * constructs * default * enum * export * exports * function * global * inherits * instance * interface * member * memberof * memberOf * method * mixes * mixin * module * name * namespace * override * property * requires * static * this * ``` */ typed?: boolean; } ]; /** Checks that any `@template` names are actually used in the connected `@typedef` or type alias. */ "jsdoc/check-template-names": []; /** Reports types deemed invalid (customizable and with defaults, for preventing and/or recommending replacements). */ "jsdoc/check-types": | [] | [ { /** * Avoids reporting when a bad type is found on a specified tag. */ exemptTagContexts?: { /** * Set a key `tag` to the tag to exempt */ tag?: string; /** * Set to `true` to indicate that any types on that tag will be allowed, * or to an array of strings which will only allow specific bad types. * If an array of strings is given, these must match the type exactly, * e.g., if you only allow `"object"`, it will not allow * `"object<string, string>"`. Note that this is different from the * behavior of `settings.jsdoc.preferredTypes`. This option is useful * for normally restricting generic types like `object` with * `preferredTypes`, but allowing `typedef` to indicate that its base * type is `object`. */ types?: boolean | string[]; }[]; /** * Insists that only the supplied option type * map is to be used, and that the default preferences (such as "string" * over "String") will not be enforced. The option's default is `false`. */ noDefaults?: boolean; /** * @deprecated Use the `preferredTypes[preferredType]` setting of the same name instead. * If this option is `true`, will currently override `unifyParentAndChildTypeChecks` on the `preferredTypes` setting. */ unifyParentAndChildTypeChecks?: boolean; } ]; /** This rule checks the values for a handful of tags: `@version`, `@since`, `@license` and `@author`. */ "jsdoc/check-values": | [] | [ { /** * An array of allowable author values. If absent, only non-whitespace will * be checked for. */ allowedAuthors?: string[]; /** * An array of allowable license values or `true` to allow any license text. * If present as an array, will be used in place of [SPDX identifiers](https://spdx.org/licenses/). */ allowedLicenses?: string[] | boolean; /** * A string to be converted into a `RegExp` (with `v` flag) and whose first * parenthetical grouping, if present, will match the portion of the license * description to check (if no grouping is present, then the whole portion * matched will be used). Defaults to `/([^\n\r]*)/gv`, i.e., the SPDX expression * is expected before any line breaks. * * Note that the `/` delimiters are optional, but necessary to add flags. * * Defaults to using the `v` flag, so to add your own flags, encapsulate * your expression as a string, but like a literal, e.g., `/^mit$/vi`. */ licensePattern?: string; /** * Whether to enable validation that `@variation` must be a number. Defaults to * `false`. */ numericOnlyVariation?: boolean; } ]; /** Converts non-JSDoc comments preceding or following nodes into JSDoc ones */ "jsdoc/convert-to-jsdoc-comments": | [] | [ { /** * An array of prefixes to allow at the beginning of a comment. * * Defaults to `['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']`. * * Supplying your own value overrides the defaults. */ allowedPrefixes?: string[]; /** * The contexts array which will be checked for preceding content. * * Can either be strings or an object with a `context` string and an optional, default `false` `inlineCommentBlock` boolean. * * Defaults to `ArrowFunctionExpression`, `FunctionDeclaration`, * `FunctionExpression`, `TSDeclareFunction`. */ contexts?: ( | string | { context?: string; inlineCommentBlock?: boolean; } )[]; /** * The contexts array which will be checked for content on the same line after. * * Can either be strings or an object with a `context` string and an optional, default `false` `inlineCommentBlock` boolean. * * Defaults to an empty array. */ contextsAfter?: ( | string | { context?: string; inlineCommentBlock?: boolean; } )[]; /** * The contexts array which will be checked for content before and on the same * line after. * * Can either be strings or an object with a `context` string and an optional, default `false` `inlineCommentBlock` boolean. * * Defaults to `VariableDeclarator`, `TSPropertySignature`, `PropertyDefinition`. */ contextsBeforeAndAfter?: ( | string | { context?: string; inlineCommentBlock?: boolean; } )[]; /** * Set to `false` to disable fixing. */ enableFixer?: boolean; /** * What policy to enforce on the conversion of non-JSDoc comments without * line breaks. (Non-JSDoc (mulitline) comments with line breaks will always * be converted to `multi` style JSDoc comments.) * * - `multi` - Convert to multi-line style * ```js * /** * * Some text * * / * ``` * - `single` - Convert to single-line style * ```js * /** Some text * / * ``` * * Defaults to `multi`. */ enforceJsdocLineStyle?: "multi" | "single"; /** * What style of comments to which to apply JSDoc conversion. * * - `block` - Applies to block-style comments (`/* ... * /`) * - `line` - Applies to line-style comments (`// ...`) * - `both` - Applies to both block and line-style comments * * Defaults to `both`. */ lineOrBlockStyle?: "block" | "line" | "both"; } ]; /** Checks tags that are expected to be empty (e.g., `@abstract` or `@async`), reporting if they have content */ "jsdoc/empty-tags": | [] | [ { /** * If you want additional tags to be checked for their descriptions, you may * add them within this option. * * ```js * { * 'jsdoc/empty-tags': ['error', {tags: ['event']}] * } * ``` */ tags?: string[]; } ]; /** Reports use of JSDoc tags in non-tag positions (in the default "typescript" mode). */ "jsdoc/escape-inline-tags": | [] | [ { /** * A listing of tags you wish to allow unescaped. Defaults to an empty array. */ allowedInlineTags?: string[]; /** * Whether to enable the fixer. Defaults to `false`. */ enableFixer?: boolean; /** * How to escape the inline tag. * * May be "backticks" to enclose tags in backticks (treating as code segments), or * "backslash" to escape tags with a backslash, i.e., `\@` * * Defaults to "backslash". */ fixType?: "backticks" | "backslash"; } ]; /** Prohibits use of `@implements` on non-constructor functions (to enforce the tag only being used on classes/constructors). */ "jsdoc/implements-on-classes": | [] | [ { /** * Set this to an array of strings representing the AST context (or an object with * `context` and `comment` properties) where you wish the rule to be applied. * * `context` defaults to `any` and `comment` defaults to no specific comment context. * * Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`, * `FunctionExpression`). Set to `"any"` if you want * the rule to apply to any JSDoc block throughout your files (as is necessary * for finding function blocks not attached to a function declaration or * expression, i.e., `@callback` or `@function` (or its aliases `@func` or * `@method`) (including those associated with an `@interface`). * * See the ["AST and Selectors"](../#advanced-ast-and-selectors) * section of our Advanced docs for more on the expected format. */ contexts?: ( | string | { comment?: string; context?: string; } )[]; } ]; /** Reports if JSDoc `import()` statements point to a package which is not listed in `dependencies` or `devDependencies` */ "jsdoc/imports-as-dependencies": []; /** This rule reports doc comments that only restate their attached name. */ "jsdoc/informative-docs": | [] | [ { /** * The `aliases` option allows indicating words as synonyms (aliases) of each other. * * For example, with `{ aliases: { emoji: ["smiley", "winkey"] } }`, the following comment would be considered uninformative: * * ```js * /** A smiley/winkey. * / * let emoji; * ``` * * The default `aliases` option is: * * ```json * { * "a": ["an", "our"] * } * ``` */ aliases?: { /** * This interface was referenced by `undefined`'s JSON-Schema definition * via the `patternProperty` ".*". */ [k: string]: string[]; }; /** * Tags that should not be checked for valid contents. * * For example, with `{ excludedTags: ["category"] }`, the following comment would not be considered uninformative: * * ```js * /** @category Types * / * function computeTypes(node) { * // ... * } * ``` * * No tags are excluded by default. */ excludedTags?: string[]; /** * Words that are ignored when searching for one that adds meaning. * * For example, with `{ uselessWords: ["our"] }`, the following comment would be considered uninformative: * * ```js * /** Our text. * / * let text; * ``` * * The default `uselessWords` option is: * * ```json * ["a", "an", "i", "in", "of", "s", "the"] * ``` */ uselessWords?: string[]; } ]; /** Enforces minimum number of newlines before JSDoc comment blocks */ "jsdoc/lines-before-block": | [] | [ { /** * Whether to additionally check the start of blocks, such as classes or functions. * Defaults to `false`. */ checkBlockStarts?: boolean; /** * An array of tags whose presence in the JSDoc block will prevent the * application of the rule. Defaults to `['type']` (i.e., if `@type` is present, * lines before the block will not be added). */ excludedTags?: string[]; /** * This option excludes cases where the JSDoc block occurs on the same line as a * preceding code or comment. Defaults to `true`. */ ignoreSameLine?: boolean; /** * This option excludes cases where the JSDoc block is only one line long. * Defaults to `true`. */ ignoreSingleLines?: boolean; /** * The minimum number of lines to require. Defaults to 1. */ lines?: number; } ]; /** Enforces a regular expression pattern on descriptions. */ "jsdoc/match-description": | [] | [ { /** * Set this to an array of strings representing the AST context (or an object with * optional `context` and `comment` properties) where you wish the rule to be applied (e.g., * `ClassDeclaration` for ES6 classes). * * `context` defaults to `any` and `comment` defaults to no specific comment context. * * Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`, * `FunctionExpression`). Set to `"any"` if you want the rule to apply to any * JSDoc block throughout your files. * * See the ["AST and Selectors"](../#advanced-ast-and-selectors) * section of our Advanced docs for more on the expected format. */ contexts?: ( | string | { comment?: string; context?: string; } )[]; /** * If you wish to override the main block description without changing the * default `match-description` (which can cascade to the `tags` with `true`), * you may use `mainDescription`: * * ```js * { * 'jsdoc/match-description': ['error', { * mainDescription: '[A-Z].*\\.', * tags: { * param: true, * returns: true * } * }] * } * ``` * * There is no need to add `mainDescription: true`, as by default, the main * block description (and only the main block description) is linted, though you * may disable checking it by setting it to `false`. * * You may also provide an object with `message`: * * ```js * { * 'jsdoc/match-description': ['error', { * mainDescription: { * message: 'Capitalize first word of JSDoc block descriptions', * match: '[A-Z].*\\.' * }, * tags: { * param: true, * returns: true * } * }] * } * ``` */ mainDescription?: | string | boolean | { match?: string | boolean; message?: string; }; /** * You can supply your own expression to override the default, passing a * `matchDescription` string on the options object. * * Defaults to using (only) the `v` flag, so * to add your own flags, encapsulate your expression as a string, but like a * literal, e.g., `/[A-Z].*\./vi`. * * ```js * { * 'jsdoc/match-description': ['error', {matchDescription: '[A-Z].*\\.'}] * } * ``` */ matchDescription?: string; /** * You may provide a custom default message by using the following format: * * ```js * { * 'jsdoc/match-description': ['error', { * message: 'The default description should begin with a capital letter.' * }] * } * ``` * * This can be overridden per tag or for the main block description by setting * `message` within `tags` or `mainDescription`, respectively. */ message?: string; /** * If not set to `false`, will enforce that the following tags have at least * some content: * * - `@copyright` * - `@example` * - `@see` * - `@todo` * * If you supply your own tag description for any of the above tags in `tags`, * your description will take precedence. */ nonemptyTags?: boolean; /** * If you want different regular expressions to apply to tags, you may use * the `tags` option object: * * ```js * { * 'jsdoc/match-description': ['error', {tags: { * param: '\\- [A-Z].*\\.', * returns: '[A-Z].*\\.' * }}] * } * ``` * * In place of a string, you can also add `true` to indicate that a particular * tag should be linted with the `matchDescription` value (or the default). * * ```js * { * 'jsdoc/match-description': ['error', {tags: { * param: true, * returns: true * }}] * } * ``` * * Alternatively, you may supply an object with a `message` property to indicate * the error message for that tag. * * ```js * { * 'jsdoc/match-description': ['error', {tags: { * param: {message: 'Begin with a hyphen', match: '\\- [A-Z].*\\.'}, * returns: {message: 'Capitalize for returns (the default)', match: true} * }}] * } * ``` * * The tags `@param`/`@arg`/`@argument` and `@property`/`@prop` will be properly * parsed to ensure that the matched "description" text includes only the text * after the name. * * All other tags will treat the text following the tag name, a space, and * an optional curly-bracketed type expression (and another space) as part of * its "description" (e.g., for `@returns {someType} some description`, the * description is `some description` while for `@some-tag xyz`, the description * is `xyz`). */ tags?: { /** * This interface was referenced by `undefined`'s JSON-Schema definition * via the `patternProperty` ".*". */ [k: string]: | string | true | { match?: string | true; message?: string; }; }; } ]; /** Reports the name portion of a JSDoc tag if matching or not matching a given regular expression. */ "jsdoc/match-name": | [] | [ { /** * `match` is a required option containing an array of objects which determine * the conditions whereby a name is reported as being problematic. * * These objects can have any combination of the following groups of optional * properties, all of which act to confine one another. * * Note that `comment`, even if targeting a specific tag, is used to match the * whole block. So if a `comment` finds its specific tag, it may still apply * fixes found by the likes of `disallowName` even when a different tag has the * disallowed name. An alternative is to ensure that `comment` finds the specific * tag of the desired tag and/or name and no `disallowName` (or `allowName`) is * supplied. In such a case, only one error will be reported, but no fixer will * be applied, however. */ match: { /** * Indicates which names are allowed for the given tag (or `*`). * Accepts a string regular expression (optionally wrapped between two * `/` delimiters followed by optional flags) used to match the name. */ allowName?: string; /** * As with `context` but AST for the JSDoc block comment and types. */ comment?: string; /** * AST to confine the allowing or disallowing to JSDoc blocks * associated with a particular context. See the * ["AST and Selectors"](../#advanced-ast-and-selectors) * section of our Advanced docs for more on the expected format. */ context?: string; /** * As with `allowName` but indicates names that are not allowed. */ disallowName?: string; /** * An optional custom message to use when there is a match. */ message?: string; /** * If `disallowName` is supplied and this value is present, it * will replace the matched `disallowName` text. */ replacement?: string; /** * This array should include tag names or `*` to indicate the * match will apply for all tags (except as confined by any context * properties). If `*` is not used, then these rules will only apply to * the specified tags. If `tags` is omitted, then `*` is assumed. */ tags?: string[]; }[]; } ]; /** Controls how and whether JSDoc blocks can be expressed as single or multiple line blocks. */ "jsdoc/multiline-blocks": | [] | [ { /** * If `noMultilineBlocks` is set to `true` with this option and multiple tags are * found in a block, an error will not be reported. * * Since multiple-tagged lines cannot be collapsed into a single line, this option * prevents them from being reported. Set to `false` if you really want to report * any blocks. * * This option will also be applied when there is a block description and a single * tag (since a description cannot precede a tag on a single line, and also * cannot be reliably added after the tag either). * * Defaults to `true`. */ allowMultipleTags?: boolean; /** * If `noMultilineBlocks` is set with this numeric option, multiline blocks will * be permitted if containing at least the given amount of text. * * If not set, multiline blocks will not be permitted regardless of length unless * a relevant tag is present and `multilineTags` is set. * * Defaults to not being in effect. */ minimumLengthForMultiline?: number; /** * If `noMultilineBlocks` is set with this option, multiline blocks may be allowed * regardless of length as long as a tag or a tag of a certain type is present. * * If `*` is included in the array, the presence of a tags will allow for * multiline blocks (but not when without any tags unless the amount of text is * over an amount specified by `minimumLengthForMultiline`). * * If the array does not include `*` but lists certain tags, the presence of * such a tag will cause multiline blocks to be allowed. * * You may set this to an empty array to prevent any tag from permitting multiple * lines. * * Defaults to `['*']`. */ multilineTags?: "*" | string[]; /** * For multiline blocks, any non-whitespace text preceding the `* /` on the final * line will be reported. (Text preceding a newline is not reported.) * * `noMultilineBlocks` will have priority over this rule if it applies. * * Defaults to `true`. */ noFinalLineText?: boolean; /** * Requires that JSDoc blocks are restricted to single lines only unless impacted * by the options `minimumLengthForMultiline`, `multilineTags`, or * `allowMultipleTags`. * * Defaults to `false`. */ noMultilineBlocks?: boolean; /** * If this is `true`, any single line blocks will be reported, except those which * are whitelisted in `singleLineTags`. * * Defaults to `false`. */ noSingleLineBlocks?: boolean; /** * For multiline blocks, any non-whitespace text immediately after the `/**` and * space will be reported. (Text after a newline is not reported.) * * `noMultilineBlocks` will have priority over this rule if it applies. * * Defaults to `true`. */ noZeroLineText?: boolean; /** * If this number is set, it indicates a minimum line width for a single line of * JSDoc content spread over a multi-line comment block. If a single line is under * the minimum length, it will be reported so as to enforce single line JSDoc blocks * for such cases. Blocks are not reported which have multi-line descriptions, * multiple tags, a block description and tag, or tags with multi-line types or * descriptions. * * Defaults to `null`. */ requireSingleLineUnderCount?: number; /** * An array of tags which can nevertheless be allowed as single line blocks when * `noSingleLineBlocks` is set. You may set this to a empty array to * cause all single line blocks to be reported. If `'*'` is present, then * the presence of a tag will allow single line blocks (but not if a tag is * missing). * * Defaults to `['lends', 'type']`. */ singleLineTags?: string[]; } ]; /** This rule checks for multi-line-style comments which fail to meet the criteria of a JSDoc block. */ "jsdoc/no-bad-blocks": | [] | [ { /** * An array of directives that will not be reported if present at the beginning of * a multi-comment block and at-sign `/* @`. * * Defaults to `['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']` * (some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)). */ ignore?: string[]; /** * A boolean (defaulting to `false`) which if `true` will prevent all * JSDoc-like blocks with more than two initial asterisks even those without * apparent tag content. */ preventAllMultiAsteriskBlocks?: boolean; } ]; /** If tags are present, this rule will prevent empty lines in the block description. If no tags are present, this rule will prevent extra empty lines in the block description. */ "jsdoc/no-blank-block-descriptions": []; /** Removes empty blocks with nothing but possibly line breaks */ "jsdoc/no-blank-blocks": | [] | [ { /** * Whether or not to auto-remove the blank block. Defaults to `false`. */ enableFixer?: boolean; } ]; /** This rule reports defaults being used on the relevant portion of `@param` or `@default`. */ "jsdoc/no-defaults": | [] | [ { /** * Set this to an array of strings representing the AST context (or an object with * optional `context` and `comment` properties) where you wish the rule to be applied. * * `context` defaults to `any` and `comment` defaults to no specific comment context. * * Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`, * `FunctionExpression`). Set to `"any"` if you want * the rule to apply to any JSDoc block throughout your files (as is necessary * for finding function blocks not attached to a function declaration or * expression, i.e., `@callback` or `@function` (or its aliases `@func` or * `@method`) (including those associated with an `@interface`). * * See the ["AST and Selectors"](../#advanced-ast-and-selectors) * section of our Advanced docs for more on the expected format. */ contexts?: ( | string | { comment?: string; context?: string; } )[]; /** * Set this to `true` to report the presence of optional parameters. May be * used if the project is insisting on optionality being indicated by * the presence of ES6 default parameters (bearing in mind that such * "defaults" are only applied when the supplied value is missing or * `undefined` but not for `null` or other "falsey" values). */ noOptionalParamNames?: boolean; } ]; /** Reports when certain comment structures are always expected. */ "jsdoc/no-missing-syntax": | [] | [ { /** * Set this to an array of strings representing the AST context (or an object with * optional `context` and `comment` properties) where you wish the rule to be applied. * * `context` defaults to `any` and `comment` defaults to no specific comment context. * * Use the `minimum` property (defaults to 1) to indicate how many are required * for the rule to be reported. * * Use the `message` property to indicate the specific error to be shown when an * error is reported for that context being found missing. You may use * `{{context}}` and `{{comment}}` with such messages. Defaults to * `"Syntax is required: {{context}}"`, or with a comment, to * `"Syntax is required: {{context}} with {{comment}}"`. * * Set to `"any"` if you want the rule to apply to any JSDoc block throughout * your files (as is necessary for finding function blocks not attached to a * function declaration or expression, i.e., `@callback` or `@function` (or its * aliases `@func` or `@method`) (including those associated with an `@interface`). * * See the ["AST and Selectors"](../#advanced-ast-and-selectors) * section of our Advanced docs for more on the expected format. */ contexts?: ( | string | { comment?: string; context?: string; message?: string; minimum?: number; } )[]; } ]; /** Prevents use of multiple asterisks at the beginning of lines. */ "jsdoc/no-multi-asterisks": | [] | [ { /** * Set to `true` if you wish to allow asterisks after a space (as with Markdown): * * ```js * /** * * *bold* text * * / * ``` * * Defaults to `false`. */ allowWhitespace?: boolean; /** * Prevent the likes of this: * * ```js * /** * * * * * ** / * ``` * * Defaults to `true`. */ preventAtEnd?: boolean; /** * Prevent the likes of this: * * ```js * /** * * * ** * * / * ``` * * Defaults to `true`. */ preventAtMiddleLines?: boolean; } ]; /** Reports when certain comment structures are present. */ "jsdoc/no-restricted-syntax": | [] | [ { /** * Set this to an array of strings representing the AST context (or an object with * `context` and `comment` properties) where you wish the rule to be applied. * * `context` defaults to `any` and `comment` defaults to no specific comment context. * * Use the `message` property to indicate the specific error to be shown when an * error is reported for that context being found. Defaults to * `"Syntax is restricted: {{context}}"`, or with a comment, to * `"Syntax is restricted: {{context}} with {{comment}}"`. * * Set to `"any"` if you want the rule to apply to any JSDoc block throughout * your files (as is necessary for finding function blocks not attached to a * function declaration or expression, i.e., `@callback` or `@function` (or its * aliases `@func` or `@method`) (including those associated with an `@interface`). * * See the ["AST and Selectors"](../#advanced-ast-and-selectors) * section of our Advanced docs for more on the expected format. */ contexts: ( | string | { comment?: string; context?: string; message?: string; } )[]; } ]; /** This rule reports types being used on `@param` or `@returns` (redundant with TypeScript). */ "jsdoc/no-types": | [] | [ { /** * Set this to an array of strings representing the AST context (or an object with * optional `context` and `comment` properties) where you wish the rule to be applied. * * `context` defaults to `any` and `comment` defaults to no specific comment context. * * Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`, * `FunctionExpression`, `TSDeclareFunction`, `TSMethodSignature`, * `ClassDeclaration`). Set to `"any"` if you want * the rule to apply to any JSDoc block throughout your files (as is necessary * for finding function blocks not attached to a function declaration or * expression, i.e., `@callback` or `@function` (or its aliases `@func` or * `@method`) (including those associated with an `@interface`). * * See the ["AST and Selectors"](../#advanced-ast-and-selectors) * section of our Advanced docs for more on the expected format. */ contexts?: ( | string | { comment?: string; context?: string; } )[]; } ]; /** Besides some expected built-in types, prohibits any types not specified as globals or within `@typedef`. */ "jsdoc/no-undefined-types": | [] | [ { /** * Whether to check typedefs for use within the file */ checkUsedTypedefs?: boolean; /** * This array can be populated to indicate other types which * are automatically considered as defined (in addition to globals, etc.). * Defaults to an empty array. */ definedTypes?: string[]; /** * Whether to disable reporting of errors. Defaults to * `false`. This may be set to `true` in order to take advantage of only * marking defined variables as used or checking used typedefs. */ disableReporting?: boolean; /** * Whether to mark variables as used for the purposes * of the `no-unused-vars` rule when they are not found to be undefined. * Defaults to `true`. May be set to `false` to enforce a practice of not * importing types unless used in code. */ markVariablesAsUsed?: boolean; } ]; /** Prefer `@import` tags to inline `import()` statements. */ "jsdoc/prefer-import-tag": | [] | [ { /** * Whether or not to enable the fixer to add `@import` tags. */ enableFixer?: boolean; /** * Whether to allow `import()` statements within `@typedef` */ exemptTypedefs?: boolean; /** * What kind of `@import` to generate when no matching `@typedef` or `@import` is found */ outputType?: "named-import" | "namespaced-import"; } ]; /** Reports use of `any` or `*` type */ "jsdoc/reject-any-type": [];