eslint-plugin-jsdoc 46.4.5 → 46.5.0

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.
Files changed (66) hide show
  1. package/README.md +31 -0
  2. package/dist/alignTransform.js +5 -5
  3. package/dist/alignTransform.js.map +1 -1
  4. package/dist/index.js +21 -10
  5. package/dist/index.js.map +1 -1
  6. package/dist/iterateJsdoc.js +1 -1
  7. package/dist/iterateJsdoc.js.map +1 -1
  8. package/dist/rules/checkExamples.js +12 -6
  9. package/dist/rules/checkExamples.js.map +1 -1
  10. package/package.json +19 -15
  11. package/docs/advanced.md +0 -102
  12. package/docs/rules/check-access.md +0 -193
  13. package/docs/rules/check-alignment.md +0 -169
  14. package/docs/rules/check-examples.md +0 -784
  15. package/docs/rules/check-indentation.md +0 -296
  16. package/docs/rules/check-line-alignment.md +0 -1002
  17. package/docs/rules/check-param-names.md +0 -1035
  18. package/docs/rules/check-property-names.md +0 -244
  19. package/docs/rules/check-syntax.md +0 -80
  20. package/docs/rules/check-tag-names.md +0 -1132
  21. package/docs/rules/check-types.md +0 -1198
  22. package/docs/rules/check-values.md +0 -409
  23. package/docs/rules/empty-tags.md +0 -220
  24. package/docs/rules/implements-on-classes.md +0 -219
  25. package/docs/rules/imports-as-dependencies.md +0 -99
  26. package/docs/rules/informative-docs.md +0 -400
  27. package/docs/rules/match-description.md +0 -1008
  28. package/docs/rules/match-name.md +0 -249
  29. package/docs/rules/multiline-blocks.md +0 -398
  30. package/docs/rules/no-bad-blocks.md +0 -174
  31. package/docs/rules/no-blank-block-descriptions.md +0 -91
  32. package/docs/rules/no-blank-blocks.md +0 -98
  33. package/docs/rules/no-defaults.md +0 -207
  34. package/docs/rules/no-missing-syntax.md +0 -275
  35. package/docs/rules/no-multi-asterisks.md +0 -278
  36. package/docs/rules/no-restricted-syntax.md +0 -383
  37. package/docs/rules/no-types.md +0 -168
  38. package/docs/rules/no-undefined-types.md +0 -789
  39. package/docs/rules/require-asterisk-prefix.md +0 -297
  40. package/docs/rules/require-description-complete-sentence.md +0 -820
  41. package/docs/rules/require-description.md +0 -585
  42. package/docs/rules/require-example.md +0 -390
  43. package/docs/rules/require-file-overview.md +0 -324
  44. package/docs/rules/require-hyphen-before-param-description.md +0 -281
  45. package/docs/rules/require-jsdoc.md +0 -1857
  46. package/docs/rules/require-param-description.md +0 -238
  47. package/docs/rules/require-param-name.md +0 -163
  48. package/docs/rules/require-param-type.md +0 -227
  49. package/docs/rules/require-param.md +0 -1820
  50. package/docs/rules/require-property-description.md +0 -88
  51. package/docs/rules/require-property-name.md +0 -79
  52. package/docs/rules/require-property-type.md +0 -79
  53. package/docs/rules/require-property.md +0 -128
  54. package/docs/rules/require-returns-check.md +0 -1053
  55. package/docs/rules/require-returns-description.md +0 -181
  56. package/docs/rules/require-returns-type.md +0 -144
  57. package/docs/rules/require-returns.md +0 -1191
  58. package/docs/rules/require-throws.md +0 -326
  59. package/docs/rules/require-yields-check.md +0 -544
  60. package/docs/rules/require-yields.md +0 -823
  61. package/docs/rules/sort-tags.md +0 -635
  62. package/docs/rules/tag-lines.md +0 -551
  63. package/docs/rules/text-escaping.md +0 -177
  64. package/docs/rules/valid-types.md +0 -881
  65. package/docs/settings.md +0 -362
  66. package/tsconfig.json +0 -22
@@ -1 +1 @@
1
- {"version":3,"file":"checkExamples.js","names":["_iterateJsdoc","_interopRequireDefault","require","_eslint","_semver","obj","__esModule","default","zeroBasedLineIndexAdjust","likelyNestedJSDocIndentSpace","preTagSpaceLength","firstLinePrefixLength","hasCaptionRegex","escapeStringRegexp","str","replaceAll","countChars","ch","match","RegExp","length","defaultMdRules","defaultExpressionRules","quotes","semi","strict","getLinesCols","text","matchLines","colDelta","slice","lastIndexOf","_default","iterateJsdoc","report","utils","context","globalState","semver","gte","ESLint","version","column","line","has","set","Map","matchingFileNameMap","get","options","exampleCodeRegex","rejectExampleCodeRegex","checkDefaults","checkParams","checkProperties","noDefaultExampleRules","checkEslintrc","matchingFileName","matchingFileNameDefaults","matchingFileNameParams","matchingFileNameProperties","paddedIndent","baseConfig","configFile","allowInlineConfig","reportUnusedDisableDirectives","captionRequired","rulePaths","mdRules","undefined","expressionRules","getRegexFromString","checkSource","filename","defaultFileName","rules","lines","cols","skipInit","source","targetTagName","sources","tag","push","nonJSPrefacingCols","nonJSPrefacingLines","string","checkRules","cliConfig","useEslintrc","cliConfigStr","JSON","stringify","src","fileNameMapKey","file","cliFile","cli","CLIEngine","config","getConfigForFile","results","messages","executeOnText","number","codeStartLine","codeStartCol","message","severity","ruleId","startLine","startCol","targetSource","getFilenameInfo","ext","jsFileName","getFilename","includes","replace","filenameInfo","forEachPreferredTag","description","trim","getTagDescription","tagName","getPreferredTagName","hasTag","matchingFilenameInfo","test","startingIndex","lastStringCount","exampleCode","lastIndex","exec","index","n0","n1","preMatch","preMatchLines","nonJSPreface","nonJSPrefaceLineCount","idx","indexOf","charsInLastLine","global","iterateAllJsdocs","meta","docs","url","schema","additionalProperties","properties","type","exports","module"],"sources":["../../src/rules/checkExamples.js"],"sourcesContent":["// Todo: When replace `CLIEngine` with `ESLint` when feature set complete per https://github.com/eslint/eslint/issues/14745\n// https://github.com/eslint/eslint/blob/master/docs/user-guide/migrating-to-7.0.0.md#-the-cliengine-class-has-been-deprecated\nimport iterateJsdoc from '../iterateJsdoc.js';\nimport {\n // @ts-expect-error - For older ESLint\n CLIEngine,\n ESLint,\n} from 'eslint';\nimport semver from 'semver';\n\nconst 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>/u;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nconst escapeStringRegexp = (str) => {\n return str.replaceAll(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n};\n\n/**\n * @param {string} str\n * @param {string} ch\n * @returns {import('../iterateJsdoc').Integer}\n */\nconst countChars = (str, ch) => {\n return (str.match(new RegExp(escapeStringRegexp(ch), 'gu')) || []).length;\n};\n\n/** @type {import('eslint').Linter.RulesRecord} */\nconst defaultMdRules = {\n // \"always\" newline rule at end unlikely in sample code\n 'eol-last': 0,\n\n // Wouldn't generally expect example paths to resolve relative to JS file\n 'import/no-unresolved': 0,\n\n // Snippets likely too short to always include import/export info\n 'import/unambiguous': 0,\n\n 'jsdoc/require-file-overview': 0,\n\n // The end of a multiline comment would end the comment the example is in.\n 'jsdoc/require-jsdoc': 0,\n\n // Unlikely to have inadvertent debugging within examples\n 'no-console': 0,\n\n // Often wish to start `@example` code after newline; also may use\n // empty lines for spacing\n 'no-multiple-empty-lines': 0,\n\n // Many variables in examples will be `undefined`\n 'no-undef': 0,\n\n // Common to define variables for clarity without always using them\n 'no-unused-vars': 0,\n\n // See import/no-unresolved\n 'node/no-missing-import': 0,\n 'node/no-missing-require': 0,\n\n // Can generally look nicer to pad a little even if code imposes more stringency\n 'padded-blocks': 0,\n};\n\n/** @type {import('eslint').Linter.RulesRecord} */\nconst defaultExpressionRules = {\n ...defaultMdRules,\n 'chai-friendly/no-unused-expressions': 'off',\n 'no-empty-function': 'off',\n 'no-new': 'off',\n 'no-unused-expressions': 'off',\n quotes: [\n 'error', 'double',\n ],\n semi: [\n 'error', 'never',\n ],\n strict: 'off',\n};\n\n/**\n * @param {string} text\n * @returns {[\n * import('../iterateJsdoc.js').Integer,\n * import('../iterateJsdoc.js').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\nexport default iterateJsdoc(({\n report,\n utils,\n context,\n globalState,\n}) => {\n if (semver.gte(ESLint.version, '8.0.0')) {\n report(\n 'This rule cannot yet be supported for ESLint 8; you ' +\n 'should either downgrade to ESLint 7 or disable this rule. The ' +\n 'possibility for ESLint 8 support is being tracked at https://github.com/eslint/eslint/issues/14745',\n null,\n {\n column: 1,\n line: 1,\n },\n );\n\n return;\n }\n\n if (!globalState.has('checkExamples-matchingFileName')) {\n globalState.set('checkExamples-matchingFileName', new Map());\n }\n\n const matchingFileNameMap = /** @type {Map<string, string>} */ (\n globalState.get('checkExamples-matchingFileName')\n );\n\n const options = context.options[0] || {};\n let {\n exampleCodeRegex = null,\n rejectExampleCodeRegex = null,\n } = options;\n const {\n checkDefaults = false,\n checkParams = false,\n checkProperties = false,\n noDefaultExampleRules = false,\n checkEslintrc = true,\n matchingFileName = null,\n matchingFileNameDefaults = null,\n matchingFileNameParams = null,\n matchingFileNameProperties = null,\n paddedIndent = 0,\n baseConfig = {},\n configFile,\n allowInlineConfig = true,\n reportUnusedDisableDirectives = true,\n captionRequired = false,\n } = options;\n\n // Make this configurable?\n /**\n * @type {never[]}\n */\n const rulePaths = [];\n\n const mdRules = noDefaultExampleRules ? undefined : defaultMdRules;\n\n const expressionRules = noDefaultExampleRules ? undefined : defaultExpressionRules;\n\n if (exampleCodeRegex) {\n exampleCodeRegex = utils.getRegexFromString(exampleCodeRegex);\n }\n\n if (rejectExampleCodeRegex) {\n rejectExampleCodeRegex = utils.getRegexFromString(rejectExampleCodeRegex);\n }\n\n /**\n * @param {{\n * filename: string,\n * defaultFileName: string|undefined,\n * source: string,\n * targetTagName: string,\n * rules?: import('eslint').Linter.RulesRecord|undefined,\n * lines?: import('../iterateJsdoc.js').Integer,\n * cols?: import('../iterateJsdoc.js').Integer,\n * skipInit?: boolean,\n * sources?: {\n * nonJSPrefacingCols: import('../iterateJsdoc.js').Integer,\n * nonJSPrefacingLines: import('../iterateJsdoc.js').Integer,\n * string: string,\n * }[],\n * tag?: import('comment-parser').Spec & {\n * line?: import('../iterateJsdoc.js').Integer,\n * }|{\n * line: import('../iterateJsdoc.js').Integer,\n * }\n * }} cfg\n */\n const checkSource = ({\n filename,\n defaultFileName,\n rules = expressionRules,\n lines = 0,\n cols = 0,\n skipInit,\n source,\n targetTagName,\n sources = [],\n tag = {\n line: 0,\n },\n }) => {\n if (!skipInit) {\n sources.push({\n nonJSPrefacingCols: cols,\n nonJSPrefacingLines: lines,\n string: source,\n });\n }\n\n // Todo: Make fixable\n\n /**\n * @param {{\n * nonJSPrefacingCols: import('../iterateJsdoc').Integer,\n * nonJSPrefacingLines: import('../iterateJsdoc').Integer,\n * string: string\n * }} cfg\n */\n const checkRules = function ({\n nonJSPrefacingCols,\n nonJSPrefacingLines,\n string,\n }) {\n const cliConfig = {\n allowInlineConfig,\n baseConfig,\n configFile,\n reportUnusedDisableDirectives,\n rulePaths,\n rules,\n useEslintrc: checkEslintrc,\n };\n const cliConfigStr = JSON.stringify(cliConfig);\n\n const src = paddedIndent ?\n string.replaceAll(new RegExp(`(^|\\n) {${paddedIndent}}(?!$)`, 'gu'), '\\n') :\n string;\n\n // Programmatic ESLint API: https://eslint.org/docs/developer-guide/nodejs-api\n const fileNameMapKey = filename ?\n 'a' + cliConfigStr + filename :\n 'b' + cliConfigStr + defaultFileName;\n const file = filename || defaultFileName;\n let cliFile;\n if (matchingFileNameMap.has(fileNameMapKey)) {\n cliFile = matchingFileNameMap.get(fileNameMapKey);\n } else {\n const cli = new CLIEngine(cliConfig);\n let config;\n if (filename || checkEslintrc) {\n config = cli.getConfigForFile(file);\n }\n\n // We need a new instance to ensure that the rules that may only\n // be available to `file` (if it has its own `.eslintrc`),\n // will be defined.\n cliFile = new CLIEngine({\n allowInlineConfig,\n baseConfig: {\n ...baseConfig,\n ...config,\n },\n configFile,\n reportUnusedDisableDirectives,\n rulePaths,\n rules,\n useEslintrc: false,\n });\n matchingFileNameMap.set(fileNameMapKey, cliFile);\n }\n\n const {\n results: [\n {\n messages,\n },\n ],\n } = cliFile.executeOnText(src);\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: import('../iterateJsdoc.js').Integer,\n * }}\n */ (tag).line + nonJSPrefacingLines;\n const codeStartCol = likelyNestedJSDocIndentSpace;\n\n for (const {\n message,\n line,\n column,\n severity,\n ruleId,\n } of messages) {\n const startLine = codeStartLine + line + zeroBasedLineIndexAdjust;\n const startCol = codeStartCol + (\n\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 report(\n '@' + targetTagName + ' ' + (severity === 2 ? 'error' : 'warning') +\n (ruleId ? ' (' + ruleId + ')' : '') + ': ' +\n message,\n null,\n {\n column: startCol,\n line: startLine,\n },\n );\n }\n };\n\n for (const targetSource of sources) {\n checkRules(targetSource);\n }\n };\n\n /**\n *\n * @param {string} 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 {{defaultFileName: string|undefined, filename: string}}\n */\n const getFilenameInfo = (filename, ext = 'md/*.js') => {\n let defaultFileName;\n if (!filename) {\n const jsFileName = context.getFilename();\n if (typeof jsFileName === 'string' && jsFileName.includes('.')) {\n defaultFileName = jsFileName.replace(/\\..*?$/u, `.${ext}`);\n } else {\n defaultFileName = `dummy.${ext}`;\n }\n }\n\n return {\n defaultFileName,\n filename,\n };\n };\n\n if (checkDefaults) {\n const filenameInfo = getFilenameInfo(matchingFileNameDefaults, 'jsdoc-defaults');\n utils.forEachPreferredTag('default', (tag, targetTagName) => {\n if (!tag.description.trim()) {\n return;\n }\n\n checkSource({\n source: `(${utils.getTagDescription(tag)})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n if (checkParams) {\n const filenameInfo = getFilenameInfo(matchingFileNameParams, 'jsdoc-params');\n utils.forEachPreferredTag('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 utils.forEachPreferredTag('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 const tagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'example',\n }));\n if (!utils.hasTag(tagName)) {\n return;\n }\n\n const matchingFilenameInfo = getFilenameInfo(matchingFileName);\n\n utils.forEachPreferredTag('example', (tag, targetTagName) => {\n let source = /** @type {string} */ (utils.getTagDescription(tag));\n const match = source.match(hasCaptionRegex);\n\n if (captionRequired && (!match || !match[1].trim())) {\n report('Caption is expected for examples.', null, tag);\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 && !exampleCodeRegex.test(source) ||\n rejectExampleCodeRegex && rejectExampleCodeRegex.test(source)\n ) {\n return;\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 exampleCodeRegex.lastIndex = 0;\n while ((exampleCode = exampleCodeRegex.exec(source)) !== null) {\n const {\n index,\n '0': n0,\n '1': n1,\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 = exampleCodeRegex.lastIndex;\n lastStringCount = countChars(string, '\\n');\n if (!exampleCodeRegex.global) {\n break;\n }\n }\n\n skipInit = true;\n }\n\n checkSource({\n cols,\n lines,\n rules: mdRules,\n skipInit,\n source,\n sources,\n tag,\n targetTagName,\n ...matchingFilenameInfo,\n });\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Ensures that (JavaScript) examples within JSDoc adhere to ESLint rules.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-examples.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowInlineConfig: {\n default: true,\n type: 'boolean',\n },\n baseConfig: {\n type: 'object',\n },\n captionRequired: {\n default: false,\n type: 'boolean',\n },\n checkDefaults: {\n default: false,\n type: 'boolean',\n },\n checkEslintrc: {\n default: true,\n type: 'boolean',\n },\n checkParams: {\n default: false,\n type: 'boolean',\n },\n checkProperties: {\n default: false,\n type: 'boolean',\n },\n configFile: {\n type: 'string',\n },\n exampleCodeRegex: {\n type: 'string',\n },\n matchingFileName: {\n type: 'string',\n },\n matchingFileNameDefaults: {\n type: 'string',\n },\n matchingFileNameParams: {\n type: 'string',\n },\n matchingFileNameProperties: {\n type: 'string',\n },\n noDefaultExampleRules: {\n default: false,\n type: 'boolean',\n },\n paddedIndent: {\n default: 0,\n type: 'integer',\n },\n rejectExampleCodeRegex: {\n type: 'string',\n },\n reportUnusedDisableDirectives: {\n default: true,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";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AAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAC,OAAA,CAAAlJ,OAAA,GAAAyB,QAAA;AAAA0H,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAAlJ,OAAA"}
1
+ {"version":3,"file":"checkExamples.js","names":["_iterateJsdoc","_interopRequireDefault","require","_eslint","_interopRequireWildcard","_semver","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","CLIEngine","eslint","zeroBasedLineIndexAdjust","likelyNestedJSDocIndentSpace","preTagSpaceLength","firstLinePrefixLength","hasCaptionRegex","escapeStringRegexp","str","replaceAll","countChars","ch","match","RegExp","length","defaultMdRules","defaultExpressionRules","quotes","semi","strict","getLinesCols","text","matchLines","colDelta","slice","lastIndexOf","_default","iterateJsdoc","report","utils","context","globalState","semver","gte","ESLint","version","column","line","Map","matchingFileNameMap","options","exampleCodeRegex","rejectExampleCodeRegex","checkDefaults","checkParams","checkProperties","noDefaultExampleRules","checkEslintrc","matchingFileName","matchingFileNameDefaults","matchingFileNameParams","matchingFileNameProperties","paddedIndent","baseConfig","configFile","allowInlineConfig","reportUnusedDisableDirectives","captionRequired","rulePaths","mdRules","undefined","expressionRules","getRegexFromString","checkSource","filename","defaultFileName","rules","lines","cols","skipInit","source","targetTagName","sources","tag","push","nonJSPrefacingCols","nonJSPrefacingLines","string","checkRules","cliConfig","useEslintrc","cliConfigStr","JSON","stringify","src","fileNameMapKey","file","cliFile","cli","config","getConfigForFile","results","messages","executeOnText","number","codeStartLine","codeStartCol","message","severity","ruleId","startLine","startCol","targetSource","getFilenameInfo","ext","jsFileName","getFilename","includes","replace","filenameInfo","forEachPreferredTag","description","trim","getTagDescription","tagName","getPreferredTagName","hasTag","matchingFilenameInfo","test","startingIndex","lastStringCount","exampleCode","lastIndex","exec","index","n0","n1","preMatch","preMatchLines","nonJSPreface","nonJSPrefaceLineCount","idx","indexOf","charsInLastLine","global","iterateAllJsdocs","meta","docs","url","schema","additionalProperties","properties","type","exports","module"],"sources":["../../src/rules/checkExamples.js"],"sourcesContent":["// Todo: When replace `CLIEngine` with `ESLint` when feature set complete per https://github.com/eslint/eslint/issues/14745\n// https://github.com/eslint/eslint/blob/master/docs/user-guide/migrating-to-7.0.0.md#-the-cliengine-class-has-been-deprecated\nimport iterateJsdoc from '../iterateJsdoc.js';\nimport eslint, {\n ESLint,\n} from 'eslint';\nimport semver from 'semver';\n\nconst {\n // @ts-expect-error Older ESLint\n CLIEngine,\n} = eslint;\n\nconst 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>/u;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nconst escapeStringRegexp = (str) => {\n return str.replaceAll(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n};\n\n/**\n * @param {string} str\n * @param {string} ch\n * @returns {import('../iterateJsdoc.js').Integer}\n */\nconst countChars = (str, ch) => {\n return (str.match(new RegExp(escapeStringRegexp(ch), 'gu')) || []).length;\n};\n\n/** @type {import('eslint').Linter.RulesRecord} */\nconst defaultMdRules = {\n // \"always\" newline rule at end unlikely in sample code\n 'eol-last': 0,\n\n // Wouldn't generally expect example paths to resolve relative to JS file\n 'import/no-unresolved': 0,\n\n // Snippets likely too short to always include import/export info\n 'import/unambiguous': 0,\n\n 'jsdoc/require-file-overview': 0,\n\n // The end of a multiline comment would end the comment the example is in.\n 'jsdoc/require-jsdoc': 0,\n\n // Unlikely to have inadvertent debugging within examples\n 'no-console': 0,\n\n // Often wish to start `@example` code after newline; also may use\n // empty lines for spacing\n 'no-multiple-empty-lines': 0,\n\n // Many variables in examples will be `undefined`\n 'no-undef': 0,\n\n // Common to define variables for clarity without always using them\n 'no-unused-vars': 0,\n\n // See import/no-unresolved\n 'node/no-missing-import': 0,\n 'node/no-missing-require': 0,\n\n // Can generally look nicer to pad a little even if code imposes more stringency\n 'padded-blocks': 0,\n};\n\n/** @type {import('eslint').Linter.RulesRecord} */\nconst defaultExpressionRules = {\n ...defaultMdRules,\n 'chai-friendly/no-unused-expressions': 'off',\n 'no-empty-function': 'off',\n 'no-new': 'off',\n 'no-unused-expressions': 'off',\n quotes: [\n 'error', 'double',\n ],\n semi: [\n 'error', 'never',\n ],\n strict: 'off',\n};\n\n/**\n * @param {string} text\n * @returns {[\n * import('../iterateJsdoc.js').Integer,\n * import('../iterateJsdoc.js').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\nexport default iterateJsdoc(({\n report,\n utils,\n context,\n globalState,\n}) => {\n if (semver.gte(ESLint.version, '8.0.0')) {\n report(\n 'This rule cannot yet be supported for ESLint 8; you ' +\n 'should either downgrade to ESLint 7 or disable this rule. The ' +\n 'possibility for ESLint 8 support is being tracked at https://github.com/eslint/eslint/issues/14745',\n null,\n {\n column: 1,\n line: 1,\n },\n );\n\n return;\n }\n\n if (!globalState.has('checkExamples-matchingFileName')) {\n globalState.set('checkExamples-matchingFileName', new Map());\n }\n\n const matchingFileNameMap = /** @type {Map<string, string>} */ (\n globalState.get('checkExamples-matchingFileName')\n );\n\n const options = context.options[0] || {};\n let {\n exampleCodeRegex = null,\n rejectExampleCodeRegex = null,\n } = options;\n const {\n checkDefaults = false,\n checkParams = false,\n checkProperties = false,\n noDefaultExampleRules = false,\n checkEslintrc = true,\n matchingFileName = null,\n matchingFileNameDefaults = null,\n matchingFileNameParams = null,\n matchingFileNameProperties = null,\n paddedIndent = 0,\n baseConfig = {},\n configFile,\n allowInlineConfig = true,\n reportUnusedDisableDirectives = true,\n captionRequired = false,\n } = options;\n\n // Make this configurable?\n /**\n * @type {never[]}\n */\n const rulePaths = [];\n\n const mdRules = noDefaultExampleRules ? undefined : defaultMdRules;\n\n const expressionRules = noDefaultExampleRules ? undefined : defaultExpressionRules;\n\n if (exampleCodeRegex) {\n exampleCodeRegex = utils.getRegexFromString(exampleCodeRegex);\n }\n\n if (rejectExampleCodeRegex) {\n rejectExampleCodeRegex = utils.getRegexFromString(rejectExampleCodeRegex);\n }\n\n /**\n * @param {{\n * filename: string,\n * defaultFileName: string|undefined,\n * source: string,\n * targetTagName: string,\n * rules?: import('eslint').Linter.RulesRecord|undefined,\n * lines?: import('../iterateJsdoc.js').Integer,\n * cols?: import('../iterateJsdoc.js').Integer,\n * skipInit?: boolean,\n * sources?: {\n * nonJSPrefacingCols: import('../iterateJsdoc.js').Integer,\n * nonJSPrefacingLines: import('../iterateJsdoc.js').Integer,\n * string: string,\n * }[],\n * tag?: import('comment-parser').Spec & {\n * line?: import('../iterateJsdoc.js').Integer,\n * }|{\n * line: import('../iterateJsdoc.js').Integer,\n * }\n * }} cfg\n */\n const checkSource = ({\n filename,\n defaultFileName,\n rules = expressionRules,\n lines = 0,\n cols = 0,\n skipInit,\n source,\n targetTagName,\n sources = [],\n tag = {\n line: 0,\n },\n }) => {\n if (!skipInit) {\n sources.push({\n nonJSPrefacingCols: cols,\n nonJSPrefacingLines: lines,\n string: source,\n });\n }\n\n // Todo: Make fixable\n\n /**\n * @param {{\n * nonJSPrefacingCols: import('../iterateJsdoc.js').Integer,\n * nonJSPrefacingLines: import('../iterateJsdoc.js').Integer,\n * string: string\n * }} cfg\n */\n const checkRules = function ({\n nonJSPrefacingCols,\n nonJSPrefacingLines,\n string,\n }) {\n const cliConfig = {\n allowInlineConfig,\n baseConfig,\n configFile,\n reportUnusedDisableDirectives,\n rulePaths,\n rules,\n useEslintrc: checkEslintrc,\n };\n const cliConfigStr = JSON.stringify(cliConfig);\n\n const src = paddedIndent ?\n string.replaceAll(new RegExp(`(^|\\n) {${paddedIndent}}(?!$)`, 'gu'), '\\n') :\n string;\n\n // Programmatic ESLint API: https://eslint.org/docs/developer-guide/nodejs-api\n const fileNameMapKey = filename ?\n 'a' + cliConfigStr + filename :\n 'b' + cliConfigStr + defaultFileName;\n const file = filename || defaultFileName;\n let cliFile;\n if (matchingFileNameMap.has(fileNameMapKey)) {\n cliFile = matchingFileNameMap.get(fileNameMapKey);\n } else {\n const cli = new CLIEngine(cliConfig);\n let config;\n if (filename || checkEslintrc) {\n config = cli.getConfigForFile(file);\n }\n\n // We need a new instance to ensure that the rules that may only\n // be available to `file` (if it has its own `.eslintrc`),\n // will be defined.\n cliFile = new CLIEngine({\n allowInlineConfig,\n baseConfig: {\n ...baseConfig,\n ...config,\n },\n configFile,\n reportUnusedDisableDirectives,\n rulePaths,\n rules,\n useEslintrc: false,\n });\n matchingFileNameMap.set(fileNameMapKey, cliFile);\n }\n\n const {\n results: [\n {\n messages,\n },\n ],\n } = cliFile.executeOnText(src);\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: import('../iterateJsdoc.js').Integer,\n * }}\n */ (tag).line + nonJSPrefacingLines;\n const codeStartCol = likelyNestedJSDocIndentSpace;\n\n for (const {\n message,\n line,\n column,\n severity,\n ruleId,\n } of messages) {\n const startLine = codeStartLine + line + zeroBasedLineIndexAdjust;\n const startCol = codeStartCol + (\n\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 report(\n '@' + targetTagName + ' ' + (severity === 2 ? 'error' : 'warning') +\n (ruleId ? ' (' + ruleId + ')' : '') + ': ' +\n message,\n null,\n {\n column: startCol,\n line: startLine,\n },\n );\n }\n };\n\n for (const targetSource of sources) {\n checkRules(targetSource);\n }\n };\n\n /**\n *\n * @param {string} 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 {{defaultFileName: string|undefined, filename: string}}\n */\n const getFilenameInfo = (filename, ext = 'md/*.js') => {\n let defaultFileName;\n if (!filename) {\n const jsFileName = context.getFilename();\n if (typeof jsFileName === 'string' && jsFileName.includes('.')) {\n defaultFileName = jsFileName.replace(/\\..*?$/u, `.${ext}`);\n } else {\n defaultFileName = `dummy.${ext}`;\n }\n }\n\n return {\n defaultFileName,\n filename,\n };\n };\n\n if (checkDefaults) {\n const filenameInfo = getFilenameInfo(matchingFileNameDefaults, 'jsdoc-defaults');\n utils.forEachPreferredTag('default', (tag, targetTagName) => {\n if (!tag.description.trim()) {\n return;\n }\n\n checkSource({\n source: `(${utils.getTagDescription(tag)})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n if (checkParams) {\n const filenameInfo = getFilenameInfo(matchingFileNameParams, 'jsdoc-params');\n utils.forEachPreferredTag('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 utils.forEachPreferredTag('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 const tagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'example',\n }));\n if (!utils.hasTag(tagName)) {\n return;\n }\n\n const matchingFilenameInfo = getFilenameInfo(matchingFileName);\n\n utils.forEachPreferredTag('example', (tag, targetTagName) => {\n let source = /** @type {string} */ (utils.getTagDescription(tag));\n const match = source.match(hasCaptionRegex);\n\n if (captionRequired && (!match || !match[1].trim())) {\n report('Caption is expected for examples.', null, tag);\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 && !exampleCodeRegex.test(source) ||\n rejectExampleCodeRegex && rejectExampleCodeRegex.test(source)\n ) {\n return;\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 exampleCodeRegex.lastIndex = 0;\n while ((exampleCode = exampleCodeRegex.exec(source)) !== null) {\n const {\n index,\n '0': n0,\n '1': n1,\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 = exampleCodeRegex.lastIndex;\n lastStringCount = countChars(string, '\\n');\n if (!exampleCodeRegex.global) {\n break;\n }\n }\n\n skipInit = true;\n }\n\n checkSource({\n cols,\n lines,\n rules: mdRules,\n skipInit,\n source,\n sources,\n tag,\n targetTagName,\n ...matchingFilenameInfo,\n });\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Ensures that (JavaScript) examples within JSDoc adhere to ESLint rules.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-examples.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowInlineConfig: {\n default: true,\n type: 'boolean',\n },\n baseConfig: {\n type: 'object',\n },\n captionRequired: {\n default: false,\n type: 'boolean',\n },\n checkDefaults: {\n default: false,\n type: 'boolean',\n },\n checkEslintrc: {\n default: true,\n type: 'boolean',\n },\n checkParams: {\n default: false,\n type: 'boolean',\n },\n checkProperties: {\n default: false,\n type: 'boolean',\n },\n configFile: {\n type: 'string',\n },\n exampleCodeRegex: {\n type: 'string',\n },\n matchingFileName: {\n type: 'string',\n },\n matchingFileNameDefaults: {\n type: 'string',\n },\n matchingFileNameParams: {\n type: 'string',\n },\n matchingFileNameProperties: {\n type: 'string',\n },\n noDefaultExampleRules: {\n default: false,\n type: 'boolean',\n },\n paddedIndent: {\n default: 0,\n type: 'integer',\n },\n rejectExampleCodeRegex: {\n type: 'string',\n },\n reportUnusedDisableDirectives: {\n default: true,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAEA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AAGA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAA4B,SAAAI,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,w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EAAE;UACf5D,OAAO,EAAE,KAAK;UACd6J,IAAI,EAAE;QACR,CAAC;QACDxF,UAAU,EAAE;UACVwF,IAAI,EAAE;QACR,CAAC;QACDrG,gBAAgB,EAAE;UAChBqG,IAAI,EAAE;QACR,CAAC;QACD9F,gBAAgB,EAAE;UAChB8F,IAAI,EAAE;QACR,CAAC;QACD7F,wBAAwB,EAAE;UACxB6F,IAAI,EAAE;QACR,CAAC;QACD5F,sBAAsB,EAAE;UACtB4F,IAAI,EAAE;QACR,CAAC;QACD3F,0BAA0B,EAAE;UAC1B2F,IAAI,EAAE;QACR,CAAC;QACDhG,qBAAqB,EAAE;UACrB7D,OAAO,EAAE,KAAK;UACd6J,IAAI,EAAE;QACR,CAAC;QACD1F,YAAY,EAAE;UACZnE,OAAO,EAAE,CAAC;UACV6J,IAAI,EAAE;QACR,CAAC;QACDpG,sBAAsB,EAAE;UACtBoG,IAAI,EAAE;QACR,CAAC;QACDtF,6BAA6B,EAAE;UAC7BvE,OAAO,EAAE,IAAI;UACb6J,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAC,OAAA,CAAA9J,OAAA,GAAAyC,QAAA;AAAAsH,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAA9J,OAAA"}
package/package.json CHANGED
@@ -5,9 +5,9 @@
5
5
  "url": "http://gajus.com"
6
6
  },
7
7
  "dependencies": {
8
- "@es-joy/jsdoccomment": "~0.39.4",
8
+ "@es-joy/jsdoccomment": "~0.40.1",
9
9
  "are-docs-informative": "^0.0.2",
10
- "comment-parser": "1.3.1",
10
+ "comment-parser": "1.4.0",
11
11
  "debug": "^4.3.4",
12
12
  "escape-string-regexp": "^4.0.0",
13
13
  "esquery": "^1.5.0",
@@ -17,13 +17,13 @@
17
17
  },
18
18
  "description": "JSDoc linting rules for ESLint.",
19
19
  "devDependencies": {
20
- "@babel/cli": "^7.22.9",
21
- "@babel/core": "^7.22.9",
22
- "@babel/eslint-parser": "^7.22.9",
23
- "@babel/node": "^7.22.6",
20
+ "@babel/cli": "^7.22.10",
21
+ "@babel/core": "^7.22.10",
22
+ "@babel/eslint-parser": "^7.22.10",
23
+ "@babel/node": "^7.22.10",
24
24
  "@babel/plugin-syntax-class-properties": "^7.12.13",
25
25
  "@babel/plugin-transform-flow-strip-types": "^7.22.5",
26
- "@babel/preset-env": "^7.22.9",
26
+ "@babel/preset-env": "^7.22.10",
27
27
  "@babel/register": "^7.22.5",
28
28
  "@es-joy/escodegen": "^3.5.1",
29
29
  "@es-joy/jsdoc-eslint-parser": "^0.19.0",
@@ -33,29 +33,31 @@
33
33
  "@semantic-release/npm": "^10.0.4",
34
34
  "@types/chai": "^4.3.5",
35
35
  "@types/debug": "^4.1.8",
36
- "@types/eslint": "^8.44.1",
36
+ "@types/eslint": "^8.44.2",
37
37
  "@types/esquery": "^1.5.0",
38
38
  "@types/estree": "^1.0.1",
39
+ "@types/json-schema": "^7.0.12",
39
40
  "@types/lodash.defaultsdeep": "^4.6.7",
40
41
  "@types/mocha": "^10.0.1",
41
- "@types/node": "^20.4.5",
42
+ "@types/node": "^20.5.0",
42
43
  "@types/semver": "^7.5.0",
43
44
  "@types/spdx-expression-parse": "^3.0.2",
44
- "@typescript-eslint/parser": "^6.2.0",
45
+ "@typescript-eslint/parser": "^6.4.0",
45
46
  "babel-plugin-add-module-exports": "^1.0.4",
46
47
  "babel-plugin-istanbul": "^6.1.1",
47
48
  "camelcase": "^6.3.0",
48
49
  "chai": "^4.3.7",
49
50
  "cross-env": "^7.0.3",
50
51
  "decamelize": "^5.0.1",
51
- "eslint": "8.45.0",
52
- "eslint-config-canonical": "~41.1.5",
52
+ "eslint": "8.47.0",
53
+ "eslint-config-canonical": "~41.1.7",
53
54
  "espree": "^9.6.1",
54
55
  "gitdown": "^3.1.5",
55
56
  "glob": "^10.3.3",
56
57
  "husky": "^8.0.3",
57
58
  "jsdoc-type-pratt-parser": "^4.0.0",
58
- "lint-staged": "^13.2.3",
59
+ "json-schema": "^0.4.0",
60
+ "lint-staged": "^14.0.0",
59
61
  "lodash.defaultsdeep": "^4.6.1",
60
62
  "mocha": "^10.2.0",
61
63
  "nyc": "^15.1.0",
@@ -81,6 +83,7 @@
81
83
  "*.js": "npm run lint-arg -- --fix"
82
84
  },
83
85
  "main": "./dist/index.js",
86
+ "types": "./dist/index.d.ts",
84
87
  "name": "eslint-plugin-jsdoc",
85
88
  "mocha": {
86
89
  "require": [
@@ -121,7 +124,8 @@
121
124
  },
122
125
  "scripts": {
123
126
  "tsc": "tsc",
124
- "build": "rimraf ./dist && cross-env NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps --ignore ./src/bin/*.js --no-copy-ignored",
127
+ "tsc-build": "tsc -p tsconfig-prod.json",
128
+ "build": "rimraf ./dist && cross-env NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps --ignore ./src/bin/*.js --no-copy-ignored && pnpm tsc-build",
125
129
  "check-docs": "babel-node ./src/bin/generateDocs.js --check",
126
130
  "create-docs": "npm run create-options && babel-node ./src/bin/generateDocs.js",
127
131
  "create-rule": "babel-node ./src/bin/generateRule.js",
@@ -136,5 +140,5 @@
136
140
  "test-cov": "cross-env TIMING=1 nyc --reporter text npm run test-no-cov",
137
141
  "test-index": "npm run test-no-cov -- test/rules/index.js"
138
142
  },
139
- "version": "46.4.5"
143
+ "version": "46.5.0"
140
144
  }
package/docs/advanced.md DELETED
@@ -1,102 +0,0 @@
1
- <a name="user-content-advanced"></a>
2
- <a name="advanced"></a>
3
- ## Advanced
4
-
5
- * [AST and Selectors](#user-content-advanced-ast-and-selectors)
6
- * [`contexts` format](#user-content-advanced-ast-and-selectors-contexts-format)
7
- * [Discovering available AST definitions](#user-content-advanced-ast-and-selectors-discovering-available-ast-definitions)
8
- * [Uses/Tips for AST](#user-content-advanced-ast-and-selectors-uses-tips-for-ast)
9
-
10
-
11
- <a name="user-content-advanced-ast-and-selectors"></a>
12
- <a name="advanced-ast-and-selectors"></a>
13
- ### AST and Selectors
14
-
15
- For various rules, one can add to the environments to which the rule applies
16
- by using the `contexts` option.
17
-
18
- This option works with [ESLint's selectors](https://eslint.org/docs/developer-guide/selectors) which are [esquery](https://github.com/estools/esquery/#readme)
19
- expressions one may use to target a specific node type or types, including
20
- subsets of the type(s) such as nodes with certain children or attributes.
21
-
22
- These expressions are used within ESLint plugins to find those parts of
23
- your files' code which are of interest to check. However, in
24
- `eslint-plugin-jsdoc`, we also allow you to use these selectors to define
25
- additional contexts where you wish our own rules to be applied.
26
-
27
- <a name="user-content-advanced-ast-and-selectors-contexts-format"></a>
28
- <a name="advanced-ast-and-selectors-contexts-format"></a>
29
- #### <code>contexts</code> format
30
-
31
- While at their simplest, these can be an array of string selectors, one can
32
- also supply an object with `context` (in place of the string) and one of two
33
- properties:
34
-
35
- 1. For `require-jsdoc`, there are also `inlineCommentBlock` and
36
- `minLineCount` properties. See that rule for details.
37
- 1. For `no-missing-syntax` and `no-restricted-syntax`, there is also a
38
- `message` property which allows customization of the message to be shown
39
- when the rule is triggered.
40
- 1. For `no-missing-syntax`, there is also a `minimum` property. See that rule.
41
- 1. For other rules, there is a `comment` property which adds to the `context`
42
- in requiring that the `comment` AST condition is also met, e.g., to
43
- require that certain tags are present and/or or types and type operators
44
- are in use. Note that this AST (either for `Jsdoc*` or `JsdocType*` AST)
45
- has not been standardized and should be considered experimental.
46
- Note that this property might also become obsolete if parsers begin to
47
- include JSDoc-structured AST. A
48
- [parser](https://github.com/brettz9/jsdoc-eslint-parser/) is available
49
- which aims to support comment AST as
50
- a first class citizen where comment/comment types can be used anywhere
51
- within a normal AST selector but this should only be considered
52
- experimental. When using such a parser, you need not use `comment` and
53
- can just use a plain string context. The determination of the node on
54
- which the comment is attached is based more on actual location than
55
- semantics (e.g., it will be attached to a `VariableDeclaration` if above
56
- that rather than to the `FunctionExpression` it is fundamentally
57
- describing). See
58
- [@es-joy/jsdoccomment](https://github.com/es-joy/jsdoccomment)
59
- for the precise structure of the comment (and comment type) nodes.
60
-
61
- <a name="user-content-advanced-ast-and-selectors-discovering-available-ast-definitions"></a>
62
- <a name="advanced-ast-and-selectors-discovering-available-ast-definitions"></a>
63
- #### Discovering available AST definitions
64
-
65
- To know all of the AST definitions one may target, it will depend on the
66
- [parser](https://eslint.org/docs/user-guide/configuring#specifying-parser)
67
- you are using with ESLint (e.g., `espree` is the default parser for ESLint,
68
- and this follows [EStree AST](https://github.com/estree/estree) but
69
- to support the the latest experimental features of JavaScript, one may use
70
- `@babel/eslint-parser` or to be able to have one's rules (including JSDoc rules)
71
- apply to TypeScript, one may use `@typescript-eslint/parser`, etc.
72
-
73
- So you can look up a particular parser to see its rules, e.g., browse through
74
- the [ESTree docs](https://github.com/estree/estree) as used by Espree or see
75
- ESLint's [overview of the structure of AST](https://eslint.org/docs/developer-guide/working-with-custom-parsers#the-ast-specification).
76
-
77
- However, it can sometimes be even more helpful to get an idea of AST by just
78
- providing some of your JavaScript to the wonderful
79
- [AST Explorer](https://astexplorer.net/) tool and see what AST is built out
80
- of your code. You can set the tool to the specific parser which you are using.
81
-
82
- <a name="user-content-advanced-ast-and-selectors-uses-tips-for-ast"></a>
83
- <a name="advanced-ast-and-selectors-uses-tips-for-ast"></a>
84
- #### Uses/Tips for AST
85
-
86
- And if you wish to introspect on the AST of code within your projects, you can
87
- use [eslint-plugin-query](https://github.com/brettz9/eslint-plugin-query).
88
- Though it also works as a plugin, you can use it with its own CLI, e.g.,
89
- to search your files for matching esquery selectors, optionally showing
90
- it as AST JSON.
91
-
92
- Tip: If you want to more deeply understand not just the resulting AST tree
93
- structures for any given code but also the syntax for esquery selectors so
94
- that you can, for example, find only those nodes with a child of a certain
95
- type, you can set the "Transform" feature to ESLint and test out
96
- esquery selectors in place of the selector expression (e.g., replace
97
- `'VariableDeclaration > VariableDeclarator > Identifier[name="someVar"]'` as
98
- we have
99
- [here](https://astexplorer.net/#/gist/71a93130c19599d6f197bddb29c13a59/latest))
100
- to the selector you wish so as to get messages reported in the bottom right
101
- pane which match your [esquery](https://github.com/estools/esquery/#readme)
102
- selector).
@@ -1,193 +0,0 @@
1
- <a name="user-content-check-access"></a>
2
- <a name="check-access"></a>
3
- # <code>check-access</code>
4
-
5
- * [Context and settings](#user-content-check-access-context-and-settings)
6
- * [Failing examples](#user-content-check-access-failing-examples)
7
- * [Passing examples](#user-content-check-access-passing-examples)
8
-
9
-
10
- Checks that `@access` tags use one of the following values:
11
-
12
- - "package", "private", "protected", "public"
13
-
14
- Also reports:
15
-
16
- - Mixing of `@access` with `@public`, `@private`, `@protected`, or `@package`
17
- on the same doc block.
18
- - Use of multiple instances of `@access` (or the `@public`, etc. style tags)
19
- on the same doc block.
20
-
21
- <a name="user-content-check-access-context-and-settings"></a>
22
- <a name="check-access-context-and-settings"></a>
23
- ## Context and settings
24
-
25
- |||
26
- |---|---|
27
- |Context|everywhere|
28
- |Tags|`@access`|
29
- |Recommended|false|
30
- |Settings||
31
- |Options||
32
-
33
- <a name="user-content-check-access-failing-examples"></a>
34
- <a name="check-access-failing-examples"></a>
35
- ## Failing examples
36
-
37
- The following patterns are considered problems:
38
-
39
- ````js
40
- /**
41
- * @access foo
42
- */
43
- function quux (foo) {
44
-
45
- }
46
- // Message: Missing valid JSDoc @access level.
47
-
48
- /**
49
- * @access foo
50
- */
51
- function quux (foo) {
52
-
53
- }
54
- // Settings: {"jsdoc":{"ignorePrivate":true}}
55
- // Message: Missing valid JSDoc @access level.
56
-
57
- /**
58
- * @accessLevel foo
59
- */
60
- function quux (foo) {
61
-
62
- }
63
- // Settings: {"jsdoc":{"tagNamePreference":{"access":"accessLevel"}}}
64
- // Message: Missing valid JSDoc @accessLevel level.
65
-
66
- /**
67
- * @access
68
- */
69
- function quux (foo) {
70
-
71
- }
72
- // Settings: {"jsdoc":{"tagNamePreference":{"access":false}}}
73
- // Message: Unexpected tag `@access`
74
-
75
- class MyClass {
76
- /**
77
- * @access
78
- */
79
- myClassField = 1
80
- }
81
- // Message: Missing valid JSDoc @access level.
82
-
83
- /**
84
- * @access public
85
- * @public
86
- */
87
- function quux (foo) {
88
-
89
- }
90
- // Message: The @access tag may not be used with specific access-control tags (@package, @private, @protected, or @public).
91
-
92
- /**
93
- * @access public
94
- * @access private
95
- */
96
- function quux (foo) {
97
-
98
- }
99
- // Message: At most one access-control tag may be present on a jsdoc block.
100
-
101
- /**
102
- * @access public
103
- * @access private
104
- */
105
- function quux (foo) {
106
-
107
- }
108
- // Settings: {"jsdoc":{"ignorePrivate":true}}
109
- // Message: At most one access-control tag may be present on a jsdoc block.
110
-
111
- /**
112
- * @public
113
- * @private
114
- */
115
- function quux (foo) {
116
-
117
- }
118
- // Message: At most one access-control tag may be present on a jsdoc block.
119
-
120
- /**
121
- * @public
122
- * @private
123
- */
124
- function quux (foo) {
125
-
126
- }
127
- // Settings: {"jsdoc":{"ignorePrivate":true}}
128
- // Message: At most one access-control tag may be present on a jsdoc block.
129
-
130
- /**
131
- * @public
132
- * @public
133
- */
134
- function quux (foo) {
135
-
136
- }
137
- // Message: At most one access-control tag may be present on a jsdoc block.
138
- ````
139
-
140
-
141
-
142
- <a name="user-content-check-access-passing-examples"></a>
143
- <a name="check-access-passing-examples"></a>
144
- ## Passing examples
145
-
146
- The following patterns are not considered problems:
147
-
148
- ````js
149
- /**
150
- *
151
- */
152
- function quux (foo) {
153
-
154
- }
155
-
156
- /**
157
- * @access public
158
- */
159
- function quux (foo) {
160
-
161
- }
162
-
163
- /**
164
- * @accessLevel package
165
- */
166
- function quux (foo) {
167
-
168
- }
169
- // Settings: {"jsdoc":{"tagNamePreference":{"access":"accessLevel"}}}
170
-
171
- class MyClass {
172
- /**
173
- * @access private
174
- */
175
- myClassField = 1
176
- }
177
-
178
- /**
179
- * @public
180
- */
181
- function quux (foo) {
182
-
183
- }
184
-
185
- /**
186
- * @private
187
- */
188
- function quux (foo) {
189
-
190
- }
191
- // Settings: {"jsdoc":{"ignorePrivate":true}}
192
- ````
193
-