UNPKG

eslint-plugin-jsdoc

Version:
1 lines 31.3 kB
{"version":3,"file":"getJsdocProcessorPlugin.cjs","names":["readFileSync","join","getRegexFromString","decode","forEachPreferredTag","getTagDescription","getPreferredTagName","hasTag","parseComment"],"sources":["../src/getJsdocProcessorPlugin.js"],"sourcesContent":["import {\n forEachPreferredTag,\n getPreferredTagName,\n getRegexFromString,\n getTagDescription,\n hasTag,\n} from './jsdocUtils.js';\nimport {\n parseComment,\n} from '@es-joy/jsdoccomment';\nimport * as espree from 'espree';\nimport {\n decode,\n} from 'html-entities';\nimport {\n readFileSync,\n} from 'node:fs';\nimport {\n join,\n} from 'node:path';\n/**\n * @import {\n * Integer,\n * JsdocBlockWithInline,\n * } from './iterateJsdoc.js';\n * @import {\n * ESLint,\n * Linter,\n * } from 'eslint';\n */\n\nconst {\n version,\n} = JSON.parse(\n readFileSync(join(import.meta.dirname, '../package.json'), 'utf8'),\n);\n\n// const zeroBasedLineIndexAdjust = -1;\nconst likelyNestedJSDocIndentSpace = 1;\nconst preTagSpaceLength = 1;\n\n// If a space is present, we should ignore it\nconst firstLinePrefixLength = preTagSpaceLength;\n\nconst hasCaptionRegex = /^\\s*<caption>([\\s\\S]*?)<\\/caption>/v;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nconst escapeStringRegexp = (str) => {\n return str.replaceAll(/[.*+?^$\\{\\}\\(\\)\\|\\[\\]\\\\]/gv, '\\\\$&');\n};\n\n/**\n * @param {string} str\n * @param {string} ch\n * @returns {Integer}\n */\nconst countChars = (str, ch) => {\n return (str.match(new RegExp(escapeStringRegexp(ch), 'gv')) || []).length;\n};\n\n/**\n * @param {string} text\n * @returns {[\n * Integer,\n * Integer\n * ]}\n */\nconst getLinesCols = (text) => {\n const matchLines = countChars(text, '\\n');\n\n const colDelta = matchLines ?\n text.slice(text.lastIndexOf('\\n') + 1).length :\n text.length;\n\n return [\n matchLines, colDelta,\n ];\n};\n\n/**\n * @typedef {number} Integer\n */\n/**\n * @typedef {object} JsdocProcessorOptions\n * @property {boolean} [captionRequired] Require captions for example tags\n * @property {Integer} [paddedIndent] See docs\n * @property {boolean} [checkDefaults] See docs\n * @property {boolean} [checkParams] See docs\n * @property {boolean} [checkExamples] See docs\n * @property {boolean} [checkProperties] See docs\n * @property {string} [matchingFileName] See docs\n * @property {string} [matchingFileNameDefaults] See docs\n * @property {string} [matchingFileNameParams] See docs\n * @property {string} [matchingFileNameProperties] See docs\n * @property {string|RegExp} [exampleCodeRegex] See docs\n * @property {string|RegExp} [rejectExampleCodeRegex] See docs\n * @property {string[]} [allowedLanguagesToProcess] See docs\n * @property {\"script\"|\"module\"} [sourceType] See docs\n * @property {import('eslint').Linter.ESTreeParser|import('eslint').Linter.NonESTreeParser} [parser] See docs\n */\n\n/**\n * We use a function for the ability of the user to pass in a config, but\n * without requiring all users of the plugin to do so.\n * @param {JsdocProcessorOptions} [options]\n * @returns {ESLint.Plugin}\n */\nexport const getJsdocProcessorPlugin = (options = {}) => {\n /**\n * @typedef {{\n * text: string,\n * filename: string|null|undefined\n * }} TextAndFileName\n */\n\n const {\n allowedLanguagesToProcess = [\n 'js', 'ts', 'javascript', 'typescript',\n ],\n captionRequired = false,\n checkDefaults = false,\n checkExamples = true,\n checkParams = false,\n checkProperties = false,\n exampleCodeRegex = null,\n matchingFileName = null,\n matchingFileNameDefaults = null,\n matchingFileNameParams = null,\n matchingFileNameProperties = null,\n paddedIndent = 0,\n parser = undefined,\n rejectExampleCodeRegex = null,\n sourceType = 'module',\n } = options;\n\n /** @type {RegExp} */\n let exampleCodeRegExp;\n /** @type {RegExp} */\n let rejectExampleCodeRegExp;\n\n if (exampleCodeRegex) {\n exampleCodeRegExp = typeof exampleCodeRegex === 'string' ?\n getRegexFromString(exampleCodeRegex) :\n exampleCodeRegex;\n }\n\n if (rejectExampleCodeRegex) {\n rejectExampleCodeRegExp = typeof rejectExampleCodeRegex === 'string' ?\n getRegexFromString(rejectExampleCodeRegex) :\n rejectExampleCodeRegex;\n }\n\n /**\n * @type {{\n * targetTagName: string,\n * ext: string,\n * codeStartLine: number,\n * codeStartCol: number,\n * nonJSPrefacingCols: number,\n * commentLineCols: [number, number]\n * }[]}\n */\n const otherInfo = [];\n\n /** @type {import('eslint').Linter.LintMessage[]} */\n let extraMessages = [];\n\n /**\n * @param {JsdocBlockWithInline} jsdoc\n * @param {string} jsFileName\n * @param {[number, number]} commentLineCols\n */\n const getTextsAndFileNames = (jsdoc, jsFileName, commentLineCols) => {\n /**\n * @type {TextAndFileName[]}\n */\n const textsAndFileNames = [];\n\n /**\n * @param {{\n * filename: string|null,\n * defaultFileName: string|undefined,\n * source: string,\n * targetTagName: string,\n * rules?: import('eslint').Linter.RulesRecord|undefined,\n * lines?: Integer,\n * cols?: Integer,\n * skipInit?: boolean,\n * ext: string,\n * sources?: {\n * nonJSPrefacingCols: Integer,\n * nonJSPrefacingLines: Integer,\n * string: string,\n * }[],\n * tag?: import('comment-parser').Spec & {\n * line?: Integer,\n * }|{\n * line: Integer,\n * }\n * }} cfg\n */\n const checkSource = ({\n cols = 0,\n defaultFileName,\n ext,\n filename,\n lines = 0,\n skipInit,\n source,\n sources = [],\n tag = {\n line: 0,\n },\n targetTagName,\n }) => {\n if (!skipInit) {\n sources.push({\n nonJSPrefacingCols: cols,\n nonJSPrefacingLines: lines,\n string: source,\n });\n }\n\n /**\n * @param {{\n * nonJSPrefacingCols: Integer,\n * nonJSPrefacingLines: Integer,\n * string: string\n * }} cfg\n */\n const addSourceInfo = function ({\n nonJSPrefacingCols,\n nonJSPrefacingLines,\n string,\n }) {\n const src = paddedIndent ?\n string.replaceAll(new RegExp(`(^|\\n) {${paddedIndent}}(?!$)`, 'gv'), '\\n') :\n string;\n\n // Programmatic ESLint API: https://eslint.org/docs/developer-guide/nodejs-api\n const file = filename || defaultFileName;\n\n if (!('line' in tag)) {\n tag.line = tag.source[0].number;\n }\n\n // NOTE: `tag.line` can be 0 if of form `/** @tag ... */`\n const codeStartLine = /**\n * @type {import('comment-parser').Spec & {\n * line: Integer,\n * }}\n */ (tag).line + nonJSPrefacingLines;\n const codeStartCol = likelyNestedJSDocIndentSpace;\n\n textsAndFileNames.push({\n filename: file,\n // See https://github.com/gajus/eslint-plugin-jsdoc/issues/710\n text: src.replaceAll(/(?<=\\*)\\\\(?=\\\\*\\/)/gv, '').replaceAll(/&([^\\s;]+);/gv, (_, code) => {\n // Dec\n if ((/^#\\d+$/v).test(code)) {\n return String.fromCodePoint(Number.parseInt(code.slice(1), 10));\n }\n\n // Hex\n if ((/^#x\\d+$/v).test(code)) {\n return String.fromCodePoint(Number.parseInt(code.slice(2), 16));\n }\n\n return decode(_, {\n level: 'html5',\n });\n }),\n });\n otherInfo.push({\n codeStartCol,\n codeStartLine,\n commentLineCols,\n ext,\n nonJSPrefacingCols,\n targetTagName,\n });\n };\n\n for (const targetSource of sources) {\n addSourceInfo(targetSource);\n }\n };\n\n /**\n *\n * @param {string|null} filename\n * @param {string} [ext] Since `eslint-plugin-markdown` v2, and\n * ESLint 7, this is the default which other JS-fenced rules will used.\n * Formerly \"md\" was the default.\n * @returns {{\n * defaultFileName: string|undefined,\n * filename: string|null,\n * ext: string\n * }}\n */\n const getFilenameInfo = (filename, ext = 'md/*.js') => {\n let defaultFileName;\n if (!filename) {\n if (typeof jsFileName === 'string' && jsFileName.includes('.')) {\n defaultFileName = jsFileName.replace(/\\.[^.]*$/v, `.${ext}`);\n } else {\n defaultFileName = `dummy.${ext}`;\n }\n }\n\n return {\n defaultFileName,\n ext,\n filename,\n };\n };\n\n if (checkDefaults) {\n const filenameInfo = getFilenameInfo(matchingFileNameDefaults, 'jsdoc-defaults');\n forEachPreferredTag(jsdoc, 'default', (tag, targetTagName) => {\n if (!tag.description.trim()) {\n return;\n }\n\n checkSource({\n source: `(${getTagDescription(tag)})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n if (checkParams) {\n const filenameInfo = getFilenameInfo(matchingFileNameParams, 'jsdoc-params');\n forEachPreferredTag(jsdoc, 'param', (tag, targetTagName) => {\n if (!tag.default || !tag.default.trim()) {\n return;\n }\n\n checkSource({\n source: `(${tag.default})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n if (checkProperties) {\n const filenameInfo = getFilenameInfo(matchingFileNameProperties, 'jsdoc-properties');\n forEachPreferredTag(jsdoc, 'property', (tag, targetTagName) => {\n if (!tag.default || !tag.default.trim()) {\n return;\n }\n\n checkSource({\n source: `(${tag.default})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n if (!checkExamples) {\n return textsAndFileNames;\n }\n\n const tagName = /** @type {string} */ (getPreferredTagName(jsdoc, {\n tagName: 'example',\n }));\n if (!hasTag(jsdoc, tagName)) {\n return textsAndFileNames;\n }\n\n const matchingFilenameInfo = getFilenameInfo(matchingFileName);\n\n forEachPreferredTag(jsdoc, 'example', (tag, targetTagName) => {\n let source = /** @type {string} */ (getTagDescription(tag));\n const match = source.match(hasCaptionRegex);\n\n if (captionRequired && (!match || !match[1].trim())) {\n extraMessages.push({\n column: commentLineCols[1] + 1,\n line: 1 + commentLineCols[0] + (tag.line ?? tag.source[0].number),\n message: `@${targetTagName} error - Caption is expected for examples.`,\n ruleId: 'jsdoc/example-missing-caption',\n severity: 2,\n });\n return;\n }\n\n source = source.replace(hasCaptionRegex, '');\n const [\n lines,\n cols,\n ] = match ? getLinesCols(match[0]) : [\n 0, 0,\n ];\n\n if (exampleCodeRegex && !exampleCodeRegExp.test(source) ||\n rejectExampleCodeRegex && rejectExampleCodeRegExp.test(source)\n ) {\n return;\n }\n\n // If `allowedLanguagesToProcess` is falsy, all languages should be processed.\n if (allowedLanguagesToProcess) {\n const matches = (/^\\s*```(?<language>\\S+)([\\s\\S]*)```\\s*$/v).exec(source);\n if (matches?.groups && !allowedLanguagesToProcess.includes(\n matches.groups.language.toLowerCase(),\n )) {\n return;\n }\n }\n\n const sources = [];\n let skipInit = false;\n if (exampleCodeRegex) {\n let nonJSPrefacingCols = 0;\n let nonJSPrefacingLines = 0;\n\n let startingIndex = 0;\n let lastStringCount = 0;\n\n let exampleCode;\n exampleCodeRegExp.lastIndex = 0;\n while ((exampleCode = exampleCodeRegExp.exec(source)) !== null) {\n const {\n '0': n0,\n '1': n1,\n index,\n } = exampleCode;\n\n // Count anything preceding user regex match (can affect line numbering)\n const preMatch = source.slice(startingIndex, index);\n\n const [\n preMatchLines,\n colDelta,\n ] = getLinesCols(preMatch);\n\n let nonJSPreface;\n let nonJSPrefaceLineCount;\n if (n1) {\n const idx = n0.indexOf(n1);\n nonJSPreface = n0.slice(0, idx);\n nonJSPrefaceLineCount = countChars(nonJSPreface, '\\n');\n } else {\n nonJSPreface = '';\n nonJSPrefaceLineCount = 0;\n }\n\n nonJSPrefacingLines += lastStringCount + preMatchLines + nonJSPrefaceLineCount;\n\n // Ignore `preMatch` delta if newlines here\n if (nonJSPrefaceLineCount) {\n const charsInLastLine = nonJSPreface.slice(nonJSPreface.lastIndexOf('\\n') + 1).length;\n\n nonJSPrefacingCols += charsInLastLine;\n } else {\n nonJSPrefacingCols += colDelta + nonJSPreface.length;\n }\n\n const string = n1 || n0;\n sources.push({\n nonJSPrefacingCols,\n nonJSPrefacingLines,\n string,\n });\n startingIndex = exampleCodeRegExp.lastIndex;\n lastStringCount = countChars(string, '\\n');\n if (!exampleCodeRegExp.global) {\n break;\n }\n }\n\n skipInit = true;\n }\n\n checkSource({\n cols,\n lines,\n skipInit,\n source,\n sources,\n tag,\n targetTagName,\n ...matchingFilenameInfo,\n });\n });\n\n return textsAndFileNames;\n };\n\n // See https://eslint.org/docs/latest/extend/plugins#processors-in-plugins\n // See https://eslint.org/docs/latest/extend/custom-processors\n // From https://github.com/eslint/eslint/issues/14745#issuecomment-869457265\n /*\n {\n \"files\": [\"*.js\", \"*.ts\"],\n \"processor\": \"jsdoc/example\" // a pretended value here\n },\n {\n \"files\": [\n \"*.js/*_jsdoc-example.js\",\n \"*.ts/*_jsdoc-example.js\",\n \"*.js/*_jsdoc-example.ts\"\n ],\n \"rules\": {\n // specific rules for examples in jsdoc only here\n // And other rules for `.js` and `.ts` will also be enabled for them\n }\n }\n */\n return {\n meta: {\n name: 'eslint-plugin-jsdoc/processor',\n version,\n },\n processors: {\n examples: {\n meta: {\n name: 'eslint-plugin-jsdoc/preprocessor',\n version,\n },\n /**\n * @param {import('eslint').Linter.LintMessage[][]} messages\n * @param {string} filename\n */\n postprocess ([\n jsMessages,\n ...messages\n // eslint-disable-next-line no-unused-vars -- Placeholder\n ], filename) {\n for (const [\n idx,\n message,\n ] of messages.entries()) {\n const {\n codeStartCol,\n codeStartLine,\n commentLineCols,\n nonJSPrefacingCols,\n targetTagName,\n } = otherInfo[idx];\n\n for (const msg of message) {\n const {\n column,\n endColumn,\n endLine,\n fatal,\n line,\n message: messageText,\n ruleId,\n severity,\n\n // Todo: Make fixable\n // fix\n // fix: {range: [number, number], text: string}\n // suggestions: {desc: , messageId:, fix: }[],\n } = msg;\n delete msg.fix;\n\n const [\n codeCtxLine,\n codeCtxColumn,\n ] = commentLineCols;\n const startLine = codeCtxLine + codeStartLine + line;\n\n // Seems to need one more now\n const startCol = 1 +\n codeCtxColumn + codeStartCol + (\n // This might not work for line 0, but line 0 is unlikely for examples\n line <= 1 ? nonJSPrefacingCols + firstLinePrefixLength : preTagSpaceLength\n ) + column;\n\n msg.message = '@' + targetTagName + ' ' + (severity === 2 ? 'error' : 'warning') +\n (ruleId ? ' (' + ruleId + ')' : '') + ': ' +\n (fatal ? 'Fatal: ' : '') +\n messageText;\n msg.line = startLine;\n msg.column = startCol;\n msg.endLine = endLine ? startLine + endLine : startLine;\n // added `- column` to offset what `endColumn` already seemed to include\n msg.endColumn = endColumn ? startCol - column + endColumn : startCol;\n }\n }\n\n const ret = [\n ...jsMessages,\n ].concat(...messages, ...extraMessages);\n extraMessages = [];\n return ret;\n },\n\n /**\n * @param {string} text\n * @param {string} filename\n * @returns {(string | Linter.ProcessorFile)[]}\n */\n preprocess (text, filename) {\n try {\n let ast;\n\n // May be running a second time so catch and ignore\n try {\n ast = parser ?\n // @ts-expect-error Should be present\n parser.parseForESLint(text, {\n comment: true,\n ecmaVersion: 'latest',\n sourceType,\n }).ast :\n espree.parse(text, {\n comment: true,\n ecmaVersion: 'latest',\n sourceType,\n });\n } catch {\n return [\n text,\n ];\n }\n\n /** @type {[number, number][]} */\n const commentLineCols = [];\n const jsdocComments = /** @type {import('estree').Comment[]} */ (\n /**\n * @type {import('estree').Program & {\n * comments?: import('estree').Comment[]\n * }}\n */\n (ast).comments\n ).filter((comment) => {\n return (/^\\*\\s/v).test(comment.value);\n }).map((comment) => {\n const [\n start,\n /* c8 ignore next -- Unsupporting processors only? */\n ] = comment.range ?? [];\n const textToStart = text.slice(0, start);\n\n const [\n lines,\n cols,\n ] = getLinesCols(textToStart);\n\n // const lines = [...textToStart.matchAll(/\\n/gv)].length\n // const lastLinePos = textToStart.lastIndexOf('\\n');\n // const cols = lastLinePos === -1\n // ? 0\n // : textToStart.slice(lastLinePos).length;\n commentLineCols.push([\n lines, cols,\n ]);\n return parseComment(comment);\n });\n\n return [\n text,\n ...jsdocComments.flatMap((jsdoc, idx) => {\n return getTextsAndFileNames(\n jsdoc,\n filename,\n commentLineCols[idx],\n );\n }).filter(\n /**\n * @param {TextAndFileName} file\n * @returns {file is Linter.ProcessorFile}\n */\n (file) => {\n return file !== null && file !== undefined;\n },\n ),\n ];\n /* c8 ignore next 6 */\n } catch (error) {\n // eslint-disable-next-line no-console -- Debugging\n console.log('err', filename, error);\n }\n\n return [];\n },\n supportsAutofix: true,\n },\n },\n };\n};\n"],"mappings":";;;;;;AAAA;AAOA;AAGA;AACA;AAGA;AAGA;AAEmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAM;EACJ;AACF,CAAC,GAAG,IAAI,CAAC,KAAK,CACZ,IAAAA,QAAA,YAAY,EAAC,IAAAC,UAAA,IAAI,aAAsB,iBAAiB,CAAC,EAAE,MAAM,CACnE,CAAC;;AAED;AACA,MAAM,4BAA4B,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