eslint-plugin-jsdoc 52.0.0 → 52.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generateRule.cjs +1 -1
- package/dist/generateRule.cjs.map +1 -1
- package/dist/getJsdocProcessorPlugin.cjs +33 -14
- package/dist/getJsdocProcessorPlugin.cjs.map +1 -1
- package/dist/getJsdocProcessorPlugin.d.ts +67 -0
- package/dist/getJsdocProcessorPlugin.d.ts.map +1 -0
- package/dist/iterateJsdoc.d.ts +462 -0
- package/dist/iterateJsdoc.d.ts.map +1 -0
- package/package.json +11 -17
- package/src/getJsdocProcessorPlugin.js +34 -14
- package/eslint.config.js +0 -92
- package/pnpm-workspace.yaml +0 -3
package/dist/generateRule.cjs
CHANGED
|
@@ -9,7 +9,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
9
9
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } /* eslint-disable no-console -- CLI */ /**
|
|
10
10
|
* @example
|
|
11
11
|
* ```shell
|
|
12
|
-
*
|
|
12
|
+
* pnpm run create-rule my-new-rule -- --recommended
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
15
|
// Todo: Would ideally have prompts, e.g., to ask for whether
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateRule.cjs","names":["_camelcase","_interopRequireDefault","require","_fs","_promises","_openEditor","_path","e","__esModule","default","_interopRequireWildcard","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ruleName","options","process","argv","recommended","includes","console","error","test","ruleNamesPath","ruleNames","JSON","parse","fs","readFile","push","sort","writeFile","stringify","log","ruleTemplate","camelCasedRuleName","camelCase","rulePath","existsSync","ruleTestTemplate","ruleTestPath","ruleReadmeTemplate","ruleReadmePath","replaceInOrder","checkName","newLine","oldIsCamel","oldRegex","path","offsets","readme","replace","matchedLine","n1","offset","str","oldRule","oldRuleB","alreadyIncluded","itemIndex","findIndex","item","undefined","pop","length","slice","repeat","Promise","resolve","then","chdir","__dirname","open"],"sources":["../src/bin/generateRule.js"],"sourcesContent":["/* eslint-disable no-console -- CLI */\n\nimport camelCase from 'camelcase';\nimport {\n existsSync,\n} from 'fs';\nimport fs from 'fs/promises';\n/**\n * @example\n * ```shell\n * npm run create-rule my-new-rule -- --recommended\n * ```\n */\nimport open from 'open-editor';\nimport {\n resolve,\n} from 'path';\n\n// Todo: Would ideally have prompts, e.g., to ask for whether\n// type was problem/layout, etc.\n\nconst [\n , , ruleName,\n ...options\n] = process.argv;\n\nconst recommended = options.includes('--recommended');\n\n(async () => {\n if (!ruleName) {\n console.error('Please supply a rule name');\n\n return;\n }\n\n if ((/[A-Z]/v).test(ruleName)) {\n console.error('Please ensure the rule has no capital letters');\n\n return;\n }\n\n const ruleNamesPath = './test/rules/ruleNames.json';\n // @ts-expect-error Older types?\n const ruleNames = JSON.parse(await fs.readFile(\n ruleNamesPath,\n ));\n if (!ruleNames.includes(ruleName)) {\n ruleNames.push(ruleName);\n ruleNames.sort();\n }\n\n await fs.writeFile(ruleNamesPath, JSON.stringify(ruleNames, null, 2) + '\\n');\n console.log('ruleNames', ruleNames);\n\n const ruleTemplate = `import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n utils,\n}) => {\n // Rule here\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: '',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/${ruleName}.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n // Option properties here (or remove the object)\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n`;\n\n const camelCasedRuleName = camelCase(ruleName);\n\n const rulePath = `./src/rules/${camelCasedRuleName}.js`;\n\n if (!existsSync(rulePath)) {\n await fs.writeFile(rulePath, ruleTemplate);\n }\n\n const ruleTestTemplate = `export default {\n invalid: [\n {\n code: \\`\n \\`,\n errors: [\n {\n line: 2,\n message: '',\n },\n ],\n },\n ],\n valid: [\n {\n code: \\`\n \\`,\n },\n ],\n};\n`;\n\n const ruleTestPath = `./test/rules/assertions/${camelCasedRuleName}.js`;\n if (!existsSync(ruleTestPath)) {\n await fs.writeFile(ruleTestPath, ruleTestTemplate);\n }\n\n const ruleReadmeTemplate = `# \\`${ruleName}\\`\n\n|||\n|---|---|\n|Context|everywhere|\n|Tags|\\`\\`|\n|Recommended|${recommended ? 'true' : 'false'}|\n|Settings||\n|Options||\n\n## Failing examples\n\n<!-- assertions-failing ${camelCasedRuleName} -->\n\n## Passing examples\n\n<!-- assertions-passing ${camelCasedRuleName} -->\n`;\n\n const ruleReadmePath = `./.README/rules/${ruleName}.md`;\n if (!existsSync(ruleReadmePath)) {\n await fs.writeFile(ruleReadmePath, ruleReadmeTemplate);\n }\n\n /**\n * @param {object} cfg\n * @param {string} cfg.path\n * @param {RegExp} cfg.oldRegex\n * @param {string} cfg.checkName\n * @param {string} cfg.newLine\n * @param {boolean} [cfg.oldIsCamel]\n * @returns {Promise<void>}\n */\n const replaceInOrder = async ({\n checkName,\n newLine,\n oldIsCamel,\n oldRegex,\n path,\n }) => {\n /**\n * @typedef {number} Integer\n */\n /**\n * @typedef {{\n * matchedLine: string,\n * offset: Integer,\n * oldRule: string,\n * }} OffsetInfo\n */\n /**\n * @type {OffsetInfo[]}\n */\n const offsets = [];\n\n let readme = await fs.readFile(path, 'utf8');\n readme.replace(\n oldRegex,\n /**\n * @param {string} matchedLine\n * @param {string} n1\n * @param {Integer} offset\n * @param {string} str\n * @param {object} groups\n * @param {string} groups.oldRule\n * @returns {string}\n */\n (matchedLine, n1, offset, str, {\n oldRule,\n }) => {\n offsets.push({\n matchedLine,\n offset,\n oldRule,\n });\n\n return matchedLine;\n },\n );\n\n offsets.sort(({\n oldRule,\n }, {\n oldRule: oldRuleB,\n }) => {\n return oldRule < oldRuleB ? -1 : (oldRule > oldRuleB ? 1 : 0);\n });\n\n let alreadyIncluded = false;\n const itemIndex = offsets.findIndex(({\n oldRule,\n }) => {\n alreadyIncluded ||= oldIsCamel ? camelCasedRuleName === oldRule : ruleName === oldRule;\n\n return oldIsCamel ? camelCasedRuleName < oldRule : ruleName < oldRule;\n });\n let item = itemIndex !== undefined && offsets[itemIndex];\n if (item && itemIndex === 0 &&\n\n // This property would not always be sufficient but in this case it is.\n oldIsCamel\n ) {\n item.offset = 0;\n }\n\n if (!item) {\n item = /** @type {OffsetInfo} */ (offsets.pop());\n item.offset += item.matchedLine.length;\n }\n\n if (alreadyIncluded) {\n console.log(`Rule name is already present in ${checkName}.`);\n } else {\n readme = readme.slice(0, item.offset) +\n (item.offset ? '\\n' : '') +\n newLine +\n (item.offset ? '' : '\\n') +\n readme.slice(item.offset);\n\n await fs.writeFile(path, readme);\n }\n };\n\n // await replaceInOrder({\n // checkName: 'README',\n // newLine: `{\"gitdown\": \"include\", \"file\": \"./rules/${ruleName}.md\"}`,\n // oldRegex: /\\n\\{\"gitdown\": \"include\", \"file\": \".\\/rules\\/(?<oldRule>[^.]*).md\"\\}/gv,\n // path: './.README/README.md',\n // });\n\n await replaceInOrder({\n checkName: 'index import',\n newLine: `import ${camelCasedRuleName} from './rules/${camelCasedRuleName}.js';`,\n oldIsCamel: true,\n oldRegex: /\\nimport (?<oldRule>[^ ]*) from '.\\/rules\\/\\1\\.js';/gv,\n path: './src/index.js',\n });\n\n await replaceInOrder({\n checkName: 'index recommended',\n newLine: `${' '.repeat(6)}'jsdoc/${ruleName}': ${recommended ? 'warnOrError' : '\\'off\\''},`,\n oldRegex: /\\n\\s{6}'jsdoc\\/(?<oldRule>[^']*)': .*?,/gv,\n path: './src/index.js',\n });\n\n await replaceInOrder({\n checkName: 'index rules',\n newLine: `${' '.repeat(4)}'${ruleName}': ${camelCasedRuleName},`,\n oldRegex: /\\n\\s{4}'(?<oldRule>[^']*)': [^,]*,/gv,\n path: './src/index.js',\n });\n\n await import('./generateDocs.js');\n\n /*\n console.log('Paths to open for further editing\\n');\n console.log(`open ${ruleReadmePath}`);\n console.log(`open ${rulePath}`);\n console.log(`open ${ruleTestPath}\\n`);\n */\n\n // Set chdir as somehow still in operation from other test\n process.chdir(resolve(import.meta.dirname, '../../'));\n await open([\n // Could even add editor line column numbers like `${rulePath}:1:1`\n ruleReadmePath,\n ruleTestPath,\n rulePath,\n ]);\n})();\n"],"mappings":";;AAEA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAD,OAAA;AAGA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AAOA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEc,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,wBAAAH,CAAA,EAAAI,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,uBAAA,YAAAA,CAAAH,CAAA,EAAAI,CAAA,SAAAA,CAAA,IAAAJ,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAQ,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAT,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAA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MAAMI,WAAW,GAAG,aAAa,GAAG,SAAS,GAAG;IAC3F6B,QAAQ,EAAE,2CAA2C;IACrDC,IAAI,EAAE;EACR,CAAC,CAAC;EAEF,MAAML,cAAc,CAAC;IACnBC,SAAS,EAAE,aAAa;IACxBC,OAAO,EAAE,GAAG,GAAG,CAACqB,MAAM,CAAC,CAAC,CAAC,IAAIpD,QAAQ,MAAMqB,kBAAkB,GAAG;IAChEY,QAAQ,EAAE,sCAAsC;IAChDC,IAAI,EAAE;EACR,CAAC,CAAC;EAEF,MAAAmB,OAAA,CAAAC,OAAA,GAAAC,IAAA,OAAAxE,uBAAA,CAAAR,OAAA,CAAa,mBAAmB,GAAC;;EAEjC;AACF;AACA;AACA;AACA;AACA;;EAEE;EACA2B,OAAO,CAACsD,KAAK,CAAC,IAAAF,aAAO,EAAAG,SAAA,EAAsB,QAAQ,CAAC,CAAC;EACrD,MAAM,IAAAC,mBAAI,EAAC;EACT;EACA9B,cAAc,EACdF,YAAY,EACZH,QAAQ,CACT,CAAC;AACJ,CAAC,EAAE,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"generateRule.cjs","names":["_camelcase","_interopRequireDefault","require","_fs","_promises","_openEditor","_path","e","__esModule","default","_interopRequireWildcard","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ruleName","options","process","argv","recommended","includes","console","error","test","ruleNamesPath","ruleNames","JSON","parse","fs","readFile","push","sort","writeFile","stringify","log","ruleTemplate","camelCasedRuleName","camelCase","rulePath","existsSync","ruleTestTemplate","ruleTestPath","ruleReadmeTemplate","ruleReadmePath","replaceInOrder","checkName","newLine","oldIsCamel","oldRegex","path","offsets","readme","replace","matchedLine","n1","offset","str","oldRule","oldRuleB","alreadyIncluded","itemIndex","findIndex","item","undefined","pop","length","slice","repeat","Promise","resolve","then","chdir","__dirname","open"],"sources":["../src/bin/generateRule.js"],"sourcesContent":["/* eslint-disable no-console -- CLI */\n\nimport camelCase from 'camelcase';\nimport {\n existsSync,\n} from 'fs';\nimport fs from 'fs/promises';\n/**\n * @example\n * ```shell\n * pnpm run create-rule my-new-rule -- --recommended\n * ```\n */\nimport open from 'open-editor';\nimport {\n resolve,\n} from 'path';\n\n// Todo: Would ideally have prompts, e.g., to ask for whether\n// type was problem/layout, etc.\n\nconst [\n , , ruleName,\n ...options\n] = process.argv;\n\nconst recommended = options.includes('--recommended');\n\n(async () => {\n if (!ruleName) {\n console.error('Please supply a rule name');\n\n return;\n }\n\n if ((/[A-Z]/v).test(ruleName)) {\n console.error('Please ensure the rule has no capital letters');\n\n return;\n }\n\n const ruleNamesPath = './test/rules/ruleNames.json';\n // @ts-expect-error Older types?\n const ruleNames = JSON.parse(await fs.readFile(\n ruleNamesPath,\n ));\n if (!ruleNames.includes(ruleName)) {\n ruleNames.push(ruleName);\n ruleNames.sort();\n }\n\n await fs.writeFile(ruleNamesPath, JSON.stringify(ruleNames, null, 2) + '\\n');\n console.log('ruleNames', ruleNames);\n\n const ruleTemplate = `import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n utils,\n}) => {\n // Rule here\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: '',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/${ruleName}.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n // Option properties here (or remove the object)\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n`;\n\n const camelCasedRuleName = camelCase(ruleName);\n\n const rulePath = `./src/rules/${camelCasedRuleName}.js`;\n\n if (!existsSync(rulePath)) {\n await fs.writeFile(rulePath, ruleTemplate);\n }\n\n const ruleTestTemplate = `export default {\n invalid: [\n {\n code: \\`\n \\`,\n errors: [\n {\n line: 2,\n message: '',\n },\n ],\n },\n ],\n valid: [\n {\n code: \\`\n \\`,\n },\n ],\n};\n`;\n\n const ruleTestPath = `./test/rules/assertions/${camelCasedRuleName}.js`;\n if (!existsSync(ruleTestPath)) {\n await fs.writeFile(ruleTestPath, ruleTestTemplate);\n }\n\n const ruleReadmeTemplate = `# \\`${ruleName}\\`\n\n|||\n|---|---|\n|Context|everywhere|\n|Tags|\\`\\`|\n|Recommended|${recommended ? 'true' : 'false'}|\n|Settings||\n|Options||\n\n## Failing examples\n\n<!-- assertions-failing ${camelCasedRuleName} -->\n\n## Passing examples\n\n<!-- assertions-passing ${camelCasedRuleName} -->\n`;\n\n const ruleReadmePath = `./.README/rules/${ruleName}.md`;\n if (!existsSync(ruleReadmePath)) {\n await fs.writeFile(ruleReadmePath, ruleReadmeTemplate);\n }\n\n /**\n * @param {object} cfg\n * @param {string} cfg.path\n * @param {RegExp} cfg.oldRegex\n * @param {string} cfg.checkName\n * @param {string} cfg.newLine\n * @param {boolean} [cfg.oldIsCamel]\n * @returns {Promise<void>}\n */\n const replaceInOrder = async ({\n checkName,\n newLine,\n oldIsCamel,\n oldRegex,\n path,\n }) => {\n /**\n * @typedef {number} Integer\n */\n /**\n * @typedef {{\n * matchedLine: string,\n * offset: Integer,\n * oldRule: string,\n * }} OffsetInfo\n */\n /**\n * @type {OffsetInfo[]}\n */\n const offsets = [];\n\n let readme = await fs.readFile(path, 'utf8');\n readme.replace(\n oldRegex,\n /**\n * @param {string} matchedLine\n * @param {string} n1\n * @param {Integer} offset\n * @param {string} str\n * @param {object} groups\n * @param {string} groups.oldRule\n * @returns {string}\n */\n (matchedLine, n1, offset, str, {\n oldRule,\n }) => {\n offsets.push({\n matchedLine,\n offset,\n oldRule,\n });\n\n return matchedLine;\n },\n );\n\n offsets.sort(({\n oldRule,\n }, {\n oldRule: oldRuleB,\n }) => {\n return oldRule < oldRuleB ? -1 : (oldRule > oldRuleB ? 1 : 0);\n });\n\n let alreadyIncluded = false;\n const itemIndex = offsets.findIndex(({\n oldRule,\n }) => {\n alreadyIncluded ||= oldIsCamel ? camelCasedRuleName === oldRule : ruleName === oldRule;\n\n return oldIsCamel ? camelCasedRuleName < oldRule : ruleName < oldRule;\n });\n let item = itemIndex !== undefined && offsets[itemIndex];\n if (item && itemIndex === 0 &&\n\n // This property would not always be sufficient but in this case it is.\n oldIsCamel\n ) {\n item.offset = 0;\n }\n\n if (!item) {\n item = /** @type {OffsetInfo} */ (offsets.pop());\n item.offset += item.matchedLine.length;\n }\n\n if (alreadyIncluded) {\n console.log(`Rule name is already present in ${checkName}.`);\n } else {\n readme = readme.slice(0, item.offset) +\n (item.offset ? '\\n' : '') +\n newLine +\n (item.offset ? '' : '\\n') +\n readme.slice(item.offset);\n\n await fs.writeFile(path, readme);\n }\n };\n\n // await replaceInOrder({\n // checkName: 'README',\n // newLine: `{\"gitdown\": \"include\", \"file\": \"./rules/${ruleName}.md\"}`,\n // oldRegex: /\\n\\{\"gitdown\": \"include\", \"file\": \".\\/rules\\/(?<oldRule>[^.]*).md\"\\}/gv,\n // path: './.README/README.md',\n // });\n\n await replaceInOrder({\n checkName: 'index import',\n newLine: `import ${camelCasedRuleName} from './rules/${camelCasedRuleName}.js';`,\n oldIsCamel: true,\n oldRegex: /\\nimport (?<oldRule>[^ ]*) from '.\\/rules\\/\\1\\.js';/gv,\n path: './src/index.js',\n });\n\n await replaceInOrder({\n checkName: 'index recommended',\n newLine: `${' '.repeat(6)}'jsdoc/${ruleName}': ${recommended ? 'warnOrError' : '\\'off\\''},`,\n oldRegex: /\\n\\s{6}'jsdoc\\/(?<oldRule>[^']*)': .*?,/gv,\n path: './src/index.js',\n });\n\n await replaceInOrder({\n checkName: 'index rules',\n newLine: `${' '.repeat(4)}'${ruleName}': ${camelCasedRuleName},`,\n oldRegex: /\\n\\s{4}'(?<oldRule>[^']*)': [^,]*,/gv,\n path: './src/index.js',\n });\n\n await import('./generateDocs.js');\n\n /*\n console.log('Paths to open for further editing\\n');\n console.log(`open ${ruleReadmePath}`);\n console.log(`open ${rulePath}`);\n console.log(`open ${ruleTestPath}\\n`);\n */\n\n // Set chdir as somehow still in operation from other test\n process.chdir(resol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ACA;;EAEE;EACA2B,OAAO,CAACsD,KAAK,CAAC,IAAAF,aAAO,EAAAG,SAAA,EAAsB,QAAQ,CAAC,CAAC;EACrD,MAAM,IAAAC,mBAAI,EAAC;EACT;EACA9B,cAAc,EACdF,YAAY,EACZH,QAAQ,CACT,CAAC;AACJ,CAAC,EAAE,CAAC","ignoreList":[]}
|
|
@@ -10,6 +10,17 @@ var espree = _interopRequireWildcard(require("espree"));
|
|
|
10
10
|
var _nodeFs = require("node:fs");
|
|
11
11
|
var _nodePath = require("node:path");
|
|
12
12
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
/**
|
|
14
|
+
* @import {
|
|
15
|
+
* Integer,
|
|
16
|
+
* JsdocBlockWithInline,
|
|
17
|
+
* } from './iterateJsdoc.js';
|
|
18
|
+
* @import {
|
|
19
|
+
* ESLint,
|
|
20
|
+
* Linter,
|
|
21
|
+
* } from 'eslint';
|
|
22
|
+
*/
|
|
23
|
+
|
|
13
24
|
const {
|
|
14
25
|
version
|
|
15
26
|
} = JSON.parse(
|
|
@@ -35,7 +46,7 @@ const escapeStringRegexp = str => {
|
|
|
35
46
|
/**
|
|
36
47
|
* @param {string} str
|
|
37
48
|
* @param {string} ch
|
|
38
|
-
* @returns {
|
|
49
|
+
* @returns {Integer}
|
|
39
50
|
*/
|
|
40
51
|
const countChars = (str, ch) => {
|
|
41
52
|
return (str.match(new RegExp(escapeStringRegexp(ch), 'gv')) || []).length;
|
|
@@ -44,8 +55,8 @@ const countChars = (str, ch) => {
|
|
|
44
55
|
/**
|
|
45
56
|
* @param {string} text
|
|
46
57
|
* @returns {[
|
|
47
|
-
*
|
|
48
|
-
*
|
|
58
|
+
* Integer,
|
|
59
|
+
* Integer
|
|
49
60
|
* ]}
|
|
50
61
|
*/
|
|
51
62
|
const getLinesCols = text => {
|
|
@@ -81,6 +92,7 @@ const getLinesCols = text => {
|
|
|
81
92
|
* We use a function for the ability of the user to pass in a config, but
|
|
82
93
|
* without requiring all users of the plugin to do so.
|
|
83
94
|
* @param {JsdocProcessorOptions} [options]
|
|
95
|
+
* @returns {ESLint.Plugin}
|
|
84
96
|
*/
|
|
85
97
|
const getJsdocProcessorPlugin = (options = {}) => {
|
|
86
98
|
const {
|
|
@@ -128,7 +140,7 @@ const getJsdocProcessorPlugin = (options = {}) => {
|
|
|
128
140
|
let extraMessages = [];
|
|
129
141
|
|
|
130
142
|
/**
|
|
131
|
-
* @param {
|
|
143
|
+
* @param {JsdocBlockWithInline} jsdoc
|
|
132
144
|
* @param {string} jsFileName
|
|
133
145
|
* @param {[number, number]} commentLineCols
|
|
134
146
|
*/
|
|
@@ -148,19 +160,19 @@ const getJsdocProcessorPlugin = (options = {}) => {
|
|
|
148
160
|
* source: string,
|
|
149
161
|
* targetTagName: string,
|
|
150
162
|
* rules?: import('eslint').Linter.RulesRecord|undefined,
|
|
151
|
-
* lines?:
|
|
152
|
-
* cols?:
|
|
163
|
+
* lines?: Integer,
|
|
164
|
+
* cols?: Integer,
|
|
153
165
|
* skipInit?: boolean,
|
|
154
166
|
* ext: string,
|
|
155
167
|
* sources?: {
|
|
156
|
-
* nonJSPrefacingCols:
|
|
157
|
-
* nonJSPrefacingLines:
|
|
168
|
+
* nonJSPrefacingCols: Integer,
|
|
169
|
+
* nonJSPrefacingLines: Integer,
|
|
158
170
|
* string: string,
|
|
159
171
|
* }[],
|
|
160
172
|
* tag?: import('comment-parser').Spec & {
|
|
161
|
-
* line?:
|
|
173
|
+
* line?: Integer,
|
|
162
174
|
* }|{
|
|
163
|
-
* line:
|
|
175
|
+
* line: Integer,
|
|
164
176
|
* }
|
|
165
177
|
* }} cfg
|
|
166
178
|
*/
|
|
@@ -188,8 +200,8 @@ const getJsdocProcessorPlugin = (options = {}) => {
|
|
|
188
200
|
|
|
189
201
|
/**
|
|
190
202
|
* @param {{
|
|
191
|
-
* nonJSPrefacingCols:
|
|
192
|
-
* nonJSPrefacingLines:
|
|
203
|
+
* nonJSPrefacingCols: Integer,
|
|
204
|
+
* nonJSPrefacingLines: Integer,
|
|
193
205
|
* string: string
|
|
194
206
|
* }} cfg
|
|
195
207
|
*/
|
|
@@ -210,7 +222,7 @@ const getJsdocProcessorPlugin = (options = {}) => {
|
|
|
210
222
|
const codeStartLine =
|
|
211
223
|
/**
|
|
212
224
|
* @type {import('comment-parser').Spec & {
|
|
213
|
-
* line:
|
|
225
|
+
* line: Integer,
|
|
214
226
|
* }}
|
|
215
227
|
*/
|
|
216
228
|
tag.line + nonJSPrefacingLines;
|
|
@@ -485,6 +497,7 @@ const getJsdocProcessorPlugin = (options = {}) => {
|
|
|
485
497
|
/**
|
|
486
498
|
* @param {string} text
|
|
487
499
|
* @param {string} filename
|
|
500
|
+
* @returns {(string | Linter.ProcessorFile)[]}
|
|
488
501
|
*/
|
|
489
502
|
preprocess(text, filename) {
|
|
490
503
|
try {
|
|
@@ -533,7 +546,13 @@ const getJsdocProcessorPlugin = (options = {}) => {
|
|
|
533
546
|
});
|
|
534
547
|
return [text, ...jsdocComments.flatMap((jsdoc, idx) => {
|
|
535
548
|
return getTextsAndFileNames(jsdoc, filename, commentLineCols[idx]);
|
|
536
|
-
}).filter(
|
|
549
|
+
}).filter(
|
|
550
|
+
/**
|
|
551
|
+
* @returns {file is Linter.ProcessorFile}
|
|
552
|
+
*/
|
|
553
|
+
file => {
|
|
554
|
+
return file !== null && file !== undefined;
|
|
555
|
+
})];
|
|
537
556
|
/* c8 ignore next 6 */
|
|
538
557
|
} catch (error) {
|
|
539
558
|
// eslint-disable-next-line no-console -- Debugging
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getJsdocProcessorPlugin.cjs","names":["_jsdocUtils","require","_jsdoccomment","espree","_interopRequireWildcard","_nodeFs","_nodePath","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","version","JSON","parse","readFileSync","join","__dirname","likelyNestedJSDocIndentSpace","preTagSpaceLength","firstLinePrefixLength","hasCaptionRegex","escapeStringRegexp","str","replaceAll","countChars","ch","match","RegExp","length","getLinesCols","text","matchLines","colDelta","slice","lastIndexOf","getJsdocProcessorPlugin","options","allowedLanguagesToProcess","captionRequired","checkDefaults","checkExamples","checkParams","checkProperties","exampleCodeRegex","matchingFileName","matchingFileNameDefaults","matchingFileNameParams","matchingFileNameProperties","paddedIndent","parser","undefined","rejectExampleCodeRegex","sourceType","exampleCodeRegExp","rejectExampleCodeRegExp","getRegexFromString","otherInfo","extraMessages","getTextsAndFileNames","jsdoc","jsFileName","commentLineCols","textsAndFileNames","checkSource","cols","defaultFileName","ext","filename","lines","skipInit","source","sources","tag","line","targetTagName","push","nonJSPrefacingCols","nonJSPrefacingLines","string","addSourceInfo","src","file","number","codeStartLine","codeStartCol","targetSource","getFilenameInfo","includes","replace","filenameInfo","forEachPreferredTag","description","trim","getTagDescription","tagName","getPreferredTagName","hasTag","matchingFilenameInfo","column","message","ruleId","severity","test","matches","exec","groups","language","toLowerCase","startingIndex","lastStringCount","exampleCode","lastIndex","n0","n1","index","preMatch","preMatchLines","nonJSPreface","nonJSPrefaceLineCount","idx","indexOf","charsInLastLine","global","meta","name","processors","examples","postprocess","jsMessages","messages","entries","msg","endColumn","endLine","fatal","messageText","codeCtxLine","codeCtxColumn","startLine","startCol","ret","concat","preprocess","ast","parseForESLint","comment","ecmaVersion","jsdocComments","comments","filter","value","map","start","range","textToStart","parseComment","flatMap","Boolean","error","console","log","supportsAutofix","exports"],"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 readFileSync,\n} from 'node:fs';\nimport {\n join,\n} from 'node:path';\n\nconst {\n version,\n} = JSON.parse(\n // @ts-expect-error `Buffer` is ok for `JSON.parse`\n readFileSync(join(import.meta.dirname, '../package.json')),\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 {import('./iterateJsdoc.js').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 * 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\n/**\n * @typedef {number} Integer\n */\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 */\nexport const getJsdocProcessorPlugin = (options = {}) => {\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 {import('./iterateJsdoc.js').JsdocBlockWithInline} jsdoc\n * @param {string} jsFileName\n * @param {[number, number]} commentLineCols\n */\n const getTextsAndFileNames = (jsdoc, jsFileName, commentLineCols) => {\n /**\n * @type {{\n * text: string,\n * filename: string|null|undefined\n * }[]}\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?: import('./iterateJsdoc.js').Integer,\n * cols?: import('./iterateJsdoc.js').Integer,\n * skipInit?: boolean,\n * ext: string,\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 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: import('./iterateJsdoc.js').Integer,\n * nonJSPrefacingLines: import('./iterateJsdoc.js').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: import('./iterateJsdoc.js').Integer,\n * }}\n */ (tag).line + nonJSPrefacingLines;\n const codeStartCol = likelyNestedJSDocIndentSpace;\n\n textsAndFileNames.push({\n filename: file,\n text: src,\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\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 */\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(Boolean),\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 // Todo: Reenable\n supportsAutofix: false,\n },\n },\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,aAAA,GAAAD,OAAA;AAGA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAGA,IAAAK,SAAA,GAAAL,OAAA;AAEmB,SAAAG,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CA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2F,0BAAY,EAACV,OAAO,CAAC;YAC9B,CAAC,CAAC;YAEF,OAAO,CACLnH,IAAI,EACJ,GAAGqH,aAAa,CAACS,OAAO,CAAC,CAACjG,KAAK,EAAE4D,GAAG,KAAK;cACvC,OAAO7D,oBAAoB,CACzBC,KAAK,EACLQ,QAAQ,EACRN,eAAe,CAAC0D,GAAG,CACrB,CAAC;YACH,CAAC,CAAC,CAAC8B,MAAM,CAACQ,OAAO,CAAC,CACnB;YACH;UACA,CAAC,CAAC,OAAOC,KAAK,EAAE;YACd;YACAC,OAAO,CAACC,GAAG,CAAC,KAAK,EAAE7F,QAAQ,EAAE2F,KAAK,CAAC;UACrC;UAEA,OAAO,EAAE;QACX,CAAC;QACD;QACAG,eAAe,EAAE;MACnB;IACF;EACF,CAAC;AACH,CAAC;AAACC,OAAA,CAAA/H,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"getJsdocProcessorPlugin.cjs","names":["_jsdocUtils","require","_jsdoccomment","espree","_interopRequireWildcard","_nodeFs","_nodePath","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","version","JSON","parse","readFileSync","join","__dirname","likelyNestedJSDocIndentSpace","preTagSpaceLength","firstLinePrefixLength","hasCaptionRegex","escapeStringRegexp","str","replaceAll","countChars","ch","match","RegExp","length","getLinesCols","text","matchLines","colDelta","slice","lastIndexOf","getJsdocProcessorPlugin","options","allowedLanguagesToProcess","captionRequired","checkDefaults","checkExamples","checkParams","checkProperties","exampleCodeRegex","matchingFileName","matchingFileNameDefaults","matchingFileNameParams","matchingFileNameProperties","paddedIndent","parser","undefined","rejectExampleCodeRegex","sourceType","exampleCodeRegExp","rejectExampleCodeRegExp","getRegexFromString","otherInfo","extraMessages","getTextsAndFileNames","jsdoc","jsFileName","commentLineCols","textsAndFileNames","checkSource","cols","defaultFileName","ext","filename","lines","skipInit","source","sources","tag","line","targetTagName","push","nonJSPrefacingCols","nonJSPrefacingLines","string","addSourceInfo","src","file","number","codeStartLine","codeStartCol","targetSource","getFilenameInfo","includes","replace","filenameInfo","forEachPreferredTag","description","trim","getTagDescription","tagName","getPreferredTagName","hasTag","matchingFilenameInfo","column","message","ruleId","severity","test","matches","exec","groups","language","toLowerCase","startingIndex","lastStringCount","exampleCode","lastIndex","n0","n1","index","preMatch","preMatchLines","nonJSPreface","nonJSPrefaceLineCount","idx","indexOf","charsInLastLine","global","meta","name","processors","examples","postprocess","jsMessages","messages","entries","msg","endColumn","endLine","fatal","messageText","codeCtxLine","codeCtxColumn","startLine","startCol","ret","concat","preprocess","ast","parseForESLint","comment","ecmaVersion","jsdocComments","comments","filter","value","map","start","range","textToStart","parseComment","flatMap","error","console","log","supportsAutofix","exports"],"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 readFileSync,\n} from 'node:fs';\nimport {\n join,\n} from 'node:path';\n\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 // @ts-expect-error `Buffer` is ok for `JSON.parse`\n readFileSync(join(import.meta.dirname, '../package.json')),\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/**\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 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 {{\n * text: string,\n * filename: string|null|undefined\n * }[]}\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 text: src,\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\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 * @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 // Todo: Reenable\n supportsAutofix: false,\n },\n },\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,aAAA,GAAAD,OAAA;AAGA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAGA,IAAAK,SAAA,GAAAL,OAAA;AAEmB,SAAAG,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,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
+
export function getJsdocProcessorPlugin(options?: JsdocProcessorOptions): ESLint.Plugin;
|
|
2
|
+
export type Integer = number;
|
|
3
|
+
export type JsdocProcessorOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Require captions for example tags
|
|
6
|
+
*/
|
|
7
|
+
captionRequired?: boolean | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* See docs
|
|
10
|
+
*/
|
|
11
|
+
paddedIndent?: number | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* See docs
|
|
14
|
+
*/
|
|
15
|
+
checkDefaults?: boolean | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* See docs
|
|
18
|
+
*/
|
|
19
|
+
checkParams?: boolean | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* See docs
|
|
22
|
+
*/
|
|
23
|
+
checkExamples?: boolean | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* See docs
|
|
26
|
+
*/
|
|
27
|
+
checkProperties?: boolean | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* See docs
|
|
30
|
+
*/
|
|
31
|
+
matchingFileName?: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* See docs
|
|
34
|
+
*/
|
|
35
|
+
matchingFileNameDefaults?: string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* See docs
|
|
38
|
+
*/
|
|
39
|
+
matchingFileNameParams?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* See docs
|
|
42
|
+
*/
|
|
43
|
+
matchingFileNameProperties?: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* See docs
|
|
46
|
+
*/
|
|
47
|
+
exampleCodeRegex?: string | RegExp | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* See docs
|
|
50
|
+
*/
|
|
51
|
+
rejectExampleCodeRegex?: string | RegExp | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* See docs
|
|
54
|
+
*/
|
|
55
|
+
allowedLanguagesToProcess?: string[] | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* See docs
|
|
58
|
+
*/
|
|
59
|
+
sourceType?: "module" | "script" | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* See docs
|
|
62
|
+
*/
|
|
63
|
+
parser?: Linter.ESTreeParser | Linter.NonESTreeParser | undefined;
|
|
64
|
+
};
|
|
65
|
+
import type { ESLint } from 'eslint';
|
|
66
|
+
import type { Linter } from 'eslint';
|
|
67
|
+
//# sourceMappingURL=getJsdocProcessorPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getJsdocProcessorPlugin.d.ts","sourceRoot":"","sources":["../src/getJsdocProcessorPlugin.js"],"names":[],"mappings":"AA8GO,kDAHI,qBAAqB,GACnB,aAAa,CAmjBzB;sBA7kBY,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAxDT,QAAQ;4BAAR,QAAQ"}
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {JsdocVisitor} iterator
|
|
3
|
+
* @param {RuleConfig} ruleConfig
|
|
4
|
+
* @returns {import('eslint').Rule.RuleModule}
|
|
5
|
+
*/
|
|
6
|
+
export default function iterateJsdoc(iterator: JsdocVisitor, ruleConfig: RuleConfig): import("eslint").Rule.RuleModule;
|
|
7
|
+
export { parseComment } from "@es-joy/jsdoccomment";
|
|
8
|
+
export type Integer = number;
|
|
9
|
+
export type JsdocBlockWithInline = import("@es-joy/jsdoccomment").JsdocBlockWithInline;
|
|
10
|
+
export type ContextObject = {
|
|
11
|
+
disallowName?: string;
|
|
12
|
+
allowName?: string;
|
|
13
|
+
context?: string;
|
|
14
|
+
comment?: string;
|
|
15
|
+
tags?: string[];
|
|
16
|
+
replacement?: string;
|
|
17
|
+
minimum?: Integer;
|
|
18
|
+
message?: string;
|
|
19
|
+
forceRequireReturn?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type Context = string | ContextObject;
|
|
22
|
+
export type CheckJsdoc = (info: {
|
|
23
|
+
lastIndex?: Integer;
|
|
24
|
+
isFunctionContext?: boolean;
|
|
25
|
+
selector?: string;
|
|
26
|
+
comment?: string;
|
|
27
|
+
}, handler: null | ((jsdoc: import("@es-joy/jsdoccomment").JsdocBlockWithInline) => boolean | undefined), node: import("eslint").Rule.Node) => void;
|
|
28
|
+
export type ForEachPreferredTag = (tagName: string, arrayHandler: (matchingJsdocTag: import("@es-joy/jsdoccomment").JsdocTagWithInline, targetTagName: string) => void, skipReportingBlockedTag?: boolean | undefined) => void;
|
|
29
|
+
export type ReportSettings = (message: string) => void;
|
|
30
|
+
export type ParseClosureTemplateTag = (tag: import("comment-parser").Spec) => string[];
|
|
31
|
+
export type GetPreferredTagNameObject = (cfg: {
|
|
32
|
+
tagName: string;
|
|
33
|
+
}) => string | false | {
|
|
34
|
+
message: string;
|
|
35
|
+
replacement?: string | undefined;
|
|
36
|
+
} | {
|
|
37
|
+
blocked: true;
|
|
38
|
+
tagName: string;
|
|
39
|
+
};
|
|
40
|
+
export type BasicUtils = {
|
|
41
|
+
forEachPreferredTag: ForEachPreferredTag;
|
|
42
|
+
reportSettings: ReportSettings;
|
|
43
|
+
parseClosureTemplateTag: ParseClosureTemplateTag;
|
|
44
|
+
getPreferredTagNameObject: GetPreferredTagNameObject;
|
|
45
|
+
pathDoesNotBeginWith: import("./jsdocUtils.js").PathDoesNotBeginWith;
|
|
46
|
+
};
|
|
47
|
+
export type IsIteratingFunction = () => boolean;
|
|
48
|
+
export type IsVirtualFunction = () => boolean;
|
|
49
|
+
export type Stringify = (tagBlock: import("comment-parser").Block, specRewire?: boolean | undefined) => string;
|
|
50
|
+
export type ReportJSDoc = (msg: string, tag?: import("comment-parser").Spec | {
|
|
51
|
+
line: Integer;
|
|
52
|
+
column?: Integer;
|
|
53
|
+
} | null | undefined, handler?: (() => void) | null | undefined, specRewire?: boolean | undefined, data?: undefined | {
|
|
54
|
+
[key: string]: string;
|
|
55
|
+
}) => any;
|
|
56
|
+
export type GetRegexFromString = (str: string, requiredFlags?: string | undefined) => RegExp;
|
|
57
|
+
export type GetTagDescription = (tg: import("comment-parser").Spec, returnArray?: boolean | undefined) => string[] | string;
|
|
58
|
+
export type SetTagDescription = (tg: import("comment-parser").Spec, matcher: RegExp, setter: (description: string) => string) => Integer;
|
|
59
|
+
export type GetDescription = () => {
|
|
60
|
+
description: string;
|
|
61
|
+
descriptions: string[];
|
|
62
|
+
lastDescriptionLine: Integer;
|
|
63
|
+
};
|
|
64
|
+
export type SetBlockDescription = (setter: (info: {
|
|
65
|
+
delimiter: string;
|
|
66
|
+
postDelimiter: string;
|
|
67
|
+
start: string;
|
|
68
|
+
}, seedTokens: (tokens?: Partial<import("comment-parser").Tokens>) => import("comment-parser").Tokens, descLines: string[]) => import("comment-parser").Line[]) => void;
|
|
69
|
+
export type SetDescriptionLines = (matcher: RegExp, setter: (description: string) => string) => Integer;
|
|
70
|
+
export type ChangeTag = (tag: import("comment-parser").Spec, ...tokens: Partial<import("comment-parser").Tokens>[]) => void;
|
|
71
|
+
export type SetTag = (tag: import("comment-parser").Spec & {
|
|
72
|
+
line: Integer;
|
|
73
|
+
}, tokens?: Partial<import("comment-parser").Tokens> | undefined) => void;
|
|
74
|
+
export type RemoveTag = (tagIndex: Integer, cfg?: {
|
|
75
|
+
removeEmptyBlock?: boolean;
|
|
76
|
+
tagSourceOffset?: Integer;
|
|
77
|
+
} | undefined) => void;
|
|
78
|
+
export type AddTag = (targetTagName: string, number?: number | undefined, tokens?: {} | import("comment-parser").Tokens | undefined) => void;
|
|
79
|
+
export type GetFirstLine = () => Integer | undefined;
|
|
80
|
+
export type SeedTokens = (tokens?: Partial<import("comment-parser").Tokens> | undefined) => import("comment-parser").Tokens;
|
|
81
|
+
/**
|
|
82
|
+
* Sets tokens to empty string.
|
|
83
|
+
*/
|
|
84
|
+
export type EmptyTokens = (tokens: import("comment-parser").Tokens) => void;
|
|
85
|
+
export type AddLine = (sourceIndex: Integer, tokens: Partial<import("comment-parser").Tokens>) => void;
|
|
86
|
+
export type AddLines = (tagIndex: Integer, tagSourceOffset: Integer, numLines: Integer) => void;
|
|
87
|
+
export type MakeMultiline = () => void;
|
|
88
|
+
export type GetFunctionParameterNames = (useDefaultObjectProperties?: boolean | undefined) => import("./jsdocUtils.js").ParamNameInfo[];
|
|
89
|
+
export type HasParams = () => Integer;
|
|
90
|
+
export type IsGenerator = () => boolean;
|
|
91
|
+
export type IsConstructor = () => boolean;
|
|
92
|
+
export type GetJsdocTagsDeep = (tagName: string) => false | {
|
|
93
|
+
idx: Integer;
|
|
94
|
+
name: string;
|
|
95
|
+
type: string;
|
|
96
|
+
}[];
|
|
97
|
+
export type GetPreferredTagName = (cfg: {
|
|
98
|
+
tagName: string;
|
|
99
|
+
skipReportingBlockedTag?: boolean;
|
|
100
|
+
allowObjectReturn?: boolean;
|
|
101
|
+
defaultMessage?: string;
|
|
102
|
+
}) => string | undefined | false | {
|
|
103
|
+
message: string;
|
|
104
|
+
replacement?: string | undefined;
|
|
105
|
+
} | {
|
|
106
|
+
blocked: true;
|
|
107
|
+
tagName: string;
|
|
108
|
+
};
|
|
109
|
+
export type IsValidTag = (name: string, definedTags: string[]) => boolean;
|
|
110
|
+
export type HasATag = (names: string[]) => boolean;
|
|
111
|
+
export type HasTag = (name: string) => boolean;
|
|
112
|
+
export type ComparePaths = (name: string) => (otherPathName: string) => boolean;
|
|
113
|
+
export type DropPathSegmentQuotes = (name: string) => string;
|
|
114
|
+
export type AvoidDocs = () => boolean;
|
|
115
|
+
export type TagMightHaveNamePositionTypePosition = (tagName: string, otherModeMaps?: import("./getDefaultTagStructureForMode.js").TagStructure[] | undefined) => boolean | {
|
|
116
|
+
otherMode: true;
|
|
117
|
+
};
|
|
118
|
+
export type TagMustHave = (tagName: string, otherModeMaps: import("./getDefaultTagStructureForMode.js").TagStructure[]) => boolean | {
|
|
119
|
+
otherMode: false;
|
|
120
|
+
};
|
|
121
|
+
export type TagMissingRequiredTypeOrNamepath = (tag: import("comment-parser").Spec, otherModeMaps: import("./getDefaultTagStructureForMode.js").TagStructure[]) => boolean | {
|
|
122
|
+
otherMode: false;
|
|
123
|
+
};
|
|
124
|
+
export type IsNamepathX = (tagName: string) => boolean;
|
|
125
|
+
export type GetTagStructureForMode = (mde: import("./jsdocUtils.js").ParserMode) => import("./getDefaultTagStructureForMode.js").TagStructure;
|
|
126
|
+
export type MayBeUndefinedTypeTag = (tag: import("comment-parser").Spec) => boolean;
|
|
127
|
+
export type HasValueOrExecutorHasNonEmptyResolveValue = (anyPromiseAsReturn: boolean, allBranches?: boolean | undefined) => boolean;
|
|
128
|
+
export type HasYieldValue = () => boolean;
|
|
129
|
+
export type HasYieldReturnValue = () => boolean;
|
|
130
|
+
export type HasThrowValue = () => boolean;
|
|
131
|
+
export type IsAsync = () => boolean | undefined;
|
|
132
|
+
export type GetTags = (tagName: string) => import("comment-parser").Spec[];
|
|
133
|
+
export type GetPresentTags = (tagList: string[]) => import("@es-joy/jsdoccomment").JsdocTagWithInline[];
|
|
134
|
+
export type FilterTags = (filter: (tag: import("@es-joy/jsdoccomment").JsdocTagWithInline) => boolean) => import("@es-joy/jsdoccomment").JsdocTagWithInline[];
|
|
135
|
+
export type FilterAllTags = (filter: (tag: (import("comment-parser").Spec | import("@es-joy/jsdoccomment").JsdocInlineTagNoType)) => boolean) => (import("comment-parser").Spec | import("@es-joy/jsdoccomment").JsdocInlineTagNoType)[];
|
|
136
|
+
export type GetTagsByType = (tags: import("comment-parser").Spec[]) => {
|
|
137
|
+
tagsWithNames: import("comment-parser").Spec[];
|
|
138
|
+
tagsWithoutNames: import("comment-parser").Spec[];
|
|
139
|
+
};
|
|
140
|
+
export type HasOptionTag = (tagName: string) => boolean;
|
|
141
|
+
export type GetClassNode = () => Node | null;
|
|
142
|
+
export type GetClassJsdoc = () => null | JsdocBlockWithInline;
|
|
143
|
+
export type ClassHasTag = (tagName: string) => boolean;
|
|
144
|
+
export type FindContext = (contexts: Context[], comment: string | undefined) => {
|
|
145
|
+
foundContext: Context | undefined;
|
|
146
|
+
contextStr: string;
|
|
147
|
+
};
|
|
148
|
+
export type Utils = BasicUtils & {
|
|
149
|
+
isIteratingFunction: IsIteratingFunction;
|
|
150
|
+
isVirtualFunction: IsVirtualFunction;
|
|
151
|
+
stringify: Stringify;
|
|
152
|
+
reportJSDoc: ReportJSDoc;
|
|
153
|
+
getRegexFromString: GetRegexFromString;
|
|
154
|
+
getTagDescription: GetTagDescription;
|
|
155
|
+
setTagDescription: SetTagDescription;
|
|
156
|
+
getDescription: GetDescription;
|
|
157
|
+
setBlockDescription: SetBlockDescription;
|
|
158
|
+
setDescriptionLines: SetDescriptionLines;
|
|
159
|
+
changeTag: ChangeTag;
|
|
160
|
+
setTag: SetTag;
|
|
161
|
+
removeTag: RemoveTag;
|
|
162
|
+
addTag: AddTag;
|
|
163
|
+
getFirstLine: GetFirstLine;
|
|
164
|
+
seedTokens: SeedTokens;
|
|
165
|
+
emptyTokens: EmptyTokens;
|
|
166
|
+
addLine: AddLine;
|
|
167
|
+
addLines: AddLines;
|
|
168
|
+
makeMultiline: MakeMultiline;
|
|
169
|
+
flattenRoots: import("./jsdocUtils.js").FlattenRoots;
|
|
170
|
+
getFunctionParameterNames: GetFunctionParameterNames;
|
|
171
|
+
hasParams: HasParams;
|
|
172
|
+
isGenerator: IsGenerator;
|
|
173
|
+
isConstructor: IsConstructor;
|
|
174
|
+
getJsdocTagsDeep: GetJsdocTagsDeep;
|
|
175
|
+
getPreferredTagName: GetPreferredTagName;
|
|
176
|
+
isValidTag: IsValidTag;
|
|
177
|
+
hasATag: HasATag;
|
|
178
|
+
hasTag: HasTag;
|
|
179
|
+
comparePaths: ComparePaths;
|
|
180
|
+
dropPathSegmentQuotes: DropPathSegmentQuotes;
|
|
181
|
+
avoidDocs: AvoidDocs;
|
|
182
|
+
tagMightHaveNamePosition: TagMightHaveNamePositionTypePosition;
|
|
183
|
+
tagMightHaveTypePosition: TagMightHaveNamePositionTypePosition;
|
|
184
|
+
tagMustHaveNamePosition: TagMustHave;
|
|
185
|
+
tagMustHaveTypePosition: TagMustHave;
|
|
186
|
+
tagMissingRequiredTypeOrNamepath: TagMissingRequiredTypeOrNamepath;
|
|
187
|
+
isNamepathDefiningTag: IsNamepathX;
|
|
188
|
+
isNamepathReferencingTag: IsNamepathX;
|
|
189
|
+
isNamepathOrUrlReferencingTag: IsNamepathX;
|
|
190
|
+
tagMightHaveNamepath: IsNamepathX;
|
|
191
|
+
getTagStructureForMode: GetTagStructureForMode;
|
|
192
|
+
mayBeUndefinedTypeTag: MayBeUndefinedTypeTag;
|
|
193
|
+
hasValueOrExecutorHasNonEmptyResolveValue: HasValueOrExecutorHasNonEmptyResolveValue;
|
|
194
|
+
hasYieldValue: HasYieldValue;
|
|
195
|
+
hasYieldReturnValue: HasYieldReturnValue;
|
|
196
|
+
hasThrowValue: HasThrowValue;
|
|
197
|
+
isAsync: IsAsync;
|
|
198
|
+
getTags: GetTags;
|
|
199
|
+
getPresentTags: GetPresentTags;
|
|
200
|
+
filterTags: FilterTags;
|
|
201
|
+
filterAllTags: FilterAllTags;
|
|
202
|
+
getTagsByType: GetTagsByType;
|
|
203
|
+
hasOptionTag: HasOptionTag;
|
|
204
|
+
getClassNode: GetClassNode;
|
|
205
|
+
getClassJsdoc: GetClassJsdoc;
|
|
206
|
+
classHasTag: ClassHasTag;
|
|
207
|
+
findContext: FindContext;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Should use ESLint rule's typing.
|
|
211
|
+
*/
|
|
212
|
+
export type EslintRuleMeta = import("eslint").Rule.RuleMetaData;
|
|
213
|
+
/**
|
|
214
|
+
* A plain object for tracking state as needed by rules across iterations.
|
|
215
|
+
*/
|
|
216
|
+
export type StateObject = {
|
|
217
|
+
globalTags: {};
|
|
218
|
+
hasDuplicates: {
|
|
219
|
+
[key: string]: boolean;
|
|
220
|
+
};
|
|
221
|
+
selectorMap: {
|
|
222
|
+
[selector: string]: {
|
|
223
|
+
[comment: string]: Integer;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
hasTag: {
|
|
227
|
+
[key: string]: boolean;
|
|
228
|
+
};
|
|
229
|
+
hasNonComment: number;
|
|
230
|
+
hasNonCommentBeforeTag: {
|
|
231
|
+
[key: string]: boolean | number;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* The Node AST as supplied by the parser.
|
|
236
|
+
*/
|
|
237
|
+
export type Node = import("eslint").Rule.Node;
|
|
238
|
+
export type Report = (message: string, fix?: import("eslint").Rule.ReportFixer | null | undefined, jsdocLoc?: {
|
|
239
|
+
line?: Integer;
|
|
240
|
+
column?: Integer;
|
|
241
|
+
} | (import("comment-parser").Spec & {
|
|
242
|
+
line?: Integer;
|
|
243
|
+
}) | null | undefined, data?: undefined | {
|
|
244
|
+
[key: string]: string;
|
|
245
|
+
}) => void;
|
|
246
|
+
export type PreferredTypes = {
|
|
247
|
+
[key: string]: false | string | {
|
|
248
|
+
message: string;
|
|
249
|
+
replacement?: false | string;
|
|
250
|
+
skipRootChecking?: boolean;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
export type StructuredTags = {
|
|
254
|
+
[key: string]: {
|
|
255
|
+
name?: "text" | "namepath-defining" | "namepath-referencing" | false;
|
|
256
|
+
type?: boolean | string[];
|
|
257
|
+
required?: ("name" | "type" | "typeOrNameRequired")[];
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Settings from ESLint types.
|
|
262
|
+
*/
|
|
263
|
+
export type Settings = {
|
|
264
|
+
maxLines: Integer;
|
|
265
|
+
minLines: Integer;
|
|
266
|
+
tagNamePreference: import("./jsdocUtils.js").TagNamePreference;
|
|
267
|
+
mode: import("./jsdocUtils.js").ParserMode;
|
|
268
|
+
preferredTypes: PreferredTypes;
|
|
269
|
+
structuredTags: StructuredTags;
|
|
270
|
+
[name: string]: any;
|
|
271
|
+
contexts?: Context[];
|
|
272
|
+
};
|
|
273
|
+
export type JSDocSettings = {
|
|
274
|
+
settings?: {
|
|
275
|
+
jsdoc?: {
|
|
276
|
+
ignorePrivate: boolean;
|
|
277
|
+
ignoreInternal: boolean;
|
|
278
|
+
maxLines: Integer;
|
|
279
|
+
minLines: Integer;
|
|
280
|
+
tagNamePreference: import("./jsdocUtils.js").TagNamePreference;
|
|
281
|
+
preferredTypes: PreferredTypes;
|
|
282
|
+
structuredTags: StructuredTags;
|
|
283
|
+
overrideReplacesDocs: boolean;
|
|
284
|
+
ignoreReplacesDocs: boolean;
|
|
285
|
+
implementsReplacesDocs: boolean;
|
|
286
|
+
augmentsExtendsReplacesDocs: boolean;
|
|
287
|
+
exemptDestructuredRootsFromChecks: boolean;
|
|
288
|
+
mode: import("./jsdocUtils.js").ParserMode;
|
|
289
|
+
contexts: Context[];
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Create the report function
|
|
295
|
+
*/
|
|
296
|
+
export type MakeReport = (context: import("eslint").Rule.RuleContext, commentNode: import("estree").Node) => Report;
|
|
297
|
+
export type JsdocVisitorBasic = (arg: {
|
|
298
|
+
context: import("eslint").Rule.RuleContext;
|
|
299
|
+
sourceCode: import("eslint").SourceCode;
|
|
300
|
+
indent?: string;
|
|
301
|
+
info?: {
|
|
302
|
+
comment?: string | undefined;
|
|
303
|
+
lastIndex?: Integer | undefined;
|
|
304
|
+
};
|
|
305
|
+
state?: StateObject;
|
|
306
|
+
globalState?: Map<string, Map<string, string>>;
|
|
307
|
+
jsdoc?: JsdocBlockWithInline;
|
|
308
|
+
jsdocNode?: import("eslint").Rule.Node & {
|
|
309
|
+
range: [number, number];
|
|
310
|
+
};
|
|
311
|
+
node?: Node;
|
|
312
|
+
allComments?: import("estree").Node[];
|
|
313
|
+
report?: Report;
|
|
314
|
+
makeReport?: MakeReport;
|
|
315
|
+
settings: Settings;
|
|
316
|
+
utils: BasicUtils;
|
|
317
|
+
}) => any;
|
|
318
|
+
export type JsdocVisitor = (arg: {
|
|
319
|
+
context: import("eslint").Rule.RuleContext;
|
|
320
|
+
sourceCode: import("eslint").SourceCode;
|
|
321
|
+
indent: string;
|
|
322
|
+
info: {
|
|
323
|
+
comment?: string | undefined;
|
|
324
|
+
lastIndex?: Integer | undefined;
|
|
325
|
+
};
|
|
326
|
+
state: StateObject;
|
|
327
|
+
globalState: Map<string, Map<string, string>>;
|
|
328
|
+
jsdoc: JsdocBlockWithInline;
|
|
329
|
+
jsdocNode: import("eslint").Rule.Node & {
|
|
330
|
+
range: [number, number];
|
|
331
|
+
};
|
|
332
|
+
node: Node | null;
|
|
333
|
+
allComments?: import("estree").Node[];
|
|
334
|
+
report: Report;
|
|
335
|
+
makeReport?: MakeReport;
|
|
336
|
+
settings: Settings;
|
|
337
|
+
utils: Utils;
|
|
338
|
+
}) => any;
|
|
339
|
+
export type NonCommentArgs = {
|
|
340
|
+
node: Node & {
|
|
341
|
+
range: [number, number];
|
|
342
|
+
};
|
|
343
|
+
state: StateObject;
|
|
344
|
+
};
|
|
345
|
+
export type RuleConfig = {
|
|
346
|
+
/**
|
|
347
|
+
* ESLint rule meta
|
|
348
|
+
*/
|
|
349
|
+
meta: EslintRuleMeta;
|
|
350
|
+
/**
|
|
351
|
+
* Any default contexts
|
|
352
|
+
*/
|
|
353
|
+
contextDefaults?: jsdocUtils.DefaultContexts | undefined;
|
|
354
|
+
/**
|
|
355
|
+
* Whether to force a `contexts` check
|
|
356
|
+
*/
|
|
357
|
+
contextSelected?: true | undefined;
|
|
358
|
+
/**
|
|
359
|
+
* Whether to iterate all JSDoc blocks by default
|
|
360
|
+
* regardless of context
|
|
361
|
+
*/
|
|
362
|
+
iterateAllJsdocs?: true | undefined;
|
|
363
|
+
/**
|
|
364
|
+
* Whether to check `@private` blocks (normally exempted)
|
|
365
|
+
*/
|
|
366
|
+
checkPrivate?: true | undefined;
|
|
367
|
+
/**
|
|
368
|
+
* Whether to check `@internal` blocks (normally exempted)
|
|
369
|
+
*/
|
|
370
|
+
checkInternal?: true | undefined;
|
|
371
|
+
/**
|
|
372
|
+
* Whether to iterates over all JSDoc blocks regardless of attachment
|
|
373
|
+
*/
|
|
374
|
+
checkFile?: true | undefined;
|
|
375
|
+
/**
|
|
376
|
+
* Whether to avoid relying on settings for global contexts
|
|
377
|
+
*/
|
|
378
|
+
nonGlobalSettings?: true | undefined;
|
|
379
|
+
/**
|
|
380
|
+
* Whether to disable the tracking of visited comment nodes (as
|
|
381
|
+
* non-tracked may conduct further actions)
|
|
382
|
+
*/
|
|
383
|
+
noTracking?: true | undefined;
|
|
384
|
+
/**
|
|
385
|
+
* Whether the rule expects contexts to be based on a match option
|
|
386
|
+
*/
|
|
387
|
+
matchContext?: true | undefined;
|
|
388
|
+
/**
|
|
389
|
+
* Handler to be executed upon exiting iteration of program AST
|
|
390
|
+
*/
|
|
391
|
+
exit?: ((args: {
|
|
392
|
+
context: import("eslint").Rule.RuleContext;
|
|
393
|
+
state: StateObject;
|
|
394
|
+
settings: Settings;
|
|
395
|
+
utils: BasicUtils;
|
|
396
|
+
}) => void) | undefined;
|
|
397
|
+
/**
|
|
398
|
+
* Handler to be executed if rule wishes
|
|
399
|
+
* to be supplied nodes without comments
|
|
400
|
+
*/
|
|
401
|
+
nonComment?: ((nca: NonCommentArgs) => void) | undefined;
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* @typedef {{
|
|
405
|
+
* [key: string]: false|string|{
|
|
406
|
+
* message: string,
|
|
407
|
+
* replacement?: false|string
|
|
408
|
+
* skipRootChecking?: boolean
|
|
409
|
+
* }
|
|
410
|
+
* }} PreferredTypes
|
|
411
|
+
*/
|
|
412
|
+
/**
|
|
413
|
+
* @typedef {{
|
|
414
|
+
* [key: string]: {
|
|
415
|
+
* name?: "text"|"namepath-defining"|"namepath-referencing"|false,
|
|
416
|
+
* type?: boolean|string[],
|
|
417
|
+
* required?: ("name"|"type"|"typeOrNameRequired")[]
|
|
418
|
+
* }
|
|
419
|
+
* }} StructuredTags
|
|
420
|
+
*/
|
|
421
|
+
/**
|
|
422
|
+
* Settings from ESLint types.
|
|
423
|
+
* @typedef {{
|
|
424
|
+
* maxLines: Integer,
|
|
425
|
+
* minLines: Integer,
|
|
426
|
+
* tagNamePreference: import('./jsdocUtils.js').TagNamePreference,
|
|
427
|
+
* mode: import('./jsdocUtils.js').ParserMode,
|
|
428
|
+
* preferredTypes: PreferredTypes,
|
|
429
|
+
* structuredTags: StructuredTags,
|
|
430
|
+
* [name: string]: any,
|
|
431
|
+
* contexts?: Context[]
|
|
432
|
+
* }} Settings
|
|
433
|
+
*/
|
|
434
|
+
/**
|
|
435
|
+
* @typedef {{
|
|
436
|
+
* settings?: {
|
|
437
|
+
* jsdoc?: {
|
|
438
|
+
* ignorePrivate: boolean,
|
|
439
|
+
* ignoreInternal: boolean,
|
|
440
|
+
* maxLines: Integer,
|
|
441
|
+
* minLines: Integer,
|
|
442
|
+
* tagNamePreference: import('./jsdocUtils.js').TagNamePreference,
|
|
443
|
+
* preferredTypes: PreferredTypes,
|
|
444
|
+
* structuredTags: StructuredTags,
|
|
445
|
+
* overrideReplacesDocs: boolean,
|
|
446
|
+
* ignoreReplacesDocs: boolean,
|
|
447
|
+
* implementsReplacesDocs: boolean,
|
|
448
|
+
* augmentsExtendsReplacesDocs: boolean,
|
|
449
|
+
* exemptDestructuredRootsFromChecks: boolean,
|
|
450
|
+
* mode: import('./jsdocUtils.js').ParserMode,
|
|
451
|
+
* contexts: Context[],
|
|
452
|
+
* }
|
|
453
|
+
* }
|
|
454
|
+
* }} JSDocSettings
|
|
455
|
+
*/
|
|
456
|
+
/**
|
|
457
|
+
* @param {import('eslint').Rule.RuleContext & JSDocSettings} context
|
|
458
|
+
* @returns {Settings|false}
|
|
459
|
+
*/
|
|
460
|
+
export function getSettings(context: import("eslint").Rule.RuleContext & JSDocSettings): Settings | false;
|
|
461
|
+
import * as jsdocUtils from './jsdocUtils.js';
|
|
462
|
+
//# sourceMappingURL=iterateJsdoc.d.ts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AC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAC;;;;;UAKX,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAYP;QAChB,OAAO,EAAE,OAAO,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC;QAC3C,KAAK,EAAE,WAAW,CAAC;QACnB,QAAQ,EAAE,QAAQ,CAAC;QACnB,KAAK,EAAE,UAAU,CAAA;KAClB,KAAK,IAAI;;;;;wBACO,cAAc,KAAK,IAAI;;AAzX3C;;;;;;;;GAQG;AACH;;;;;;;;GAQG;AACH;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;GAGG;AACH,qCAHW,OAAO,QAAQ,EAAE,IAAI,CAAC,WAAW,GAAG,aAAa,GAC/C,QAAQ,GAAC,KAAK,CA4D1B;4BAxxD2B,iBAAiB"}
|
package/package.json
CHANGED
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
"c8": "^10.1.3",
|
|
51
51
|
"camelcase": "^8.0.0",
|
|
52
52
|
"chai": "^5.2.0",
|
|
53
|
-
"cross-env": "^7.0.3",
|
|
54
53
|
"decamelize": "^6.0.0",
|
|
55
54
|
"eslint": "9.29.0",
|
|
56
55
|
"eslint-config-canonical": "~44.9.5",
|
|
@@ -80,11 +79,7 @@
|
|
|
80
79
|
],
|
|
81
80
|
"license": "BSD-3-Clause",
|
|
82
81
|
"lint-staged": {
|
|
83
|
-
"
|
|
84
|
-
"npm run lint-fix",
|
|
85
|
-
"git add ."
|
|
86
|
-
],
|
|
87
|
-
"*.js": "npm run lint-arg -- --fix"
|
|
82
|
+
"*.js": "eslint --fix"
|
|
88
83
|
},
|
|
89
84
|
"type": "module",
|
|
90
85
|
"main": "./dist/index.cjs",
|
|
@@ -140,25 +135,24 @@
|
|
|
140
135
|
"url": "https://github.com/gajus/eslint-plugin-jsdoc/issues"
|
|
141
136
|
},
|
|
142
137
|
"run-if-changed": {
|
|
143
|
-
"package-lock.json": "
|
|
138
|
+
"package-lock.json": "pnpm run install-offline"
|
|
144
139
|
},
|
|
145
140
|
"scripts": {
|
|
146
141
|
"tsc": "tsc",
|
|
147
142
|
"tsc-build": "tsc -p tsconfig-prod.json",
|
|
148
|
-
"build": "rimraf ./dist &&
|
|
143
|
+
"build": "rimraf ./dist && NODE_ENV=production babel ./src --out-file-extension .cjs --out-dir ./dist --copy-files --source-maps --ignore ./src/bin/*.js --no-copy-ignored && replace 'require\\(\"\\.(.*?)\\.[^.]*?\"\\)' 'require(\".$1.cjs\")' 'dist' -r --include=\"*.cjs\" && pnpm tsc-build",
|
|
149
144
|
"check-docs": "babel-node ./src/bin/generateDocs.js --check",
|
|
150
|
-
"create-docs": "
|
|
145
|
+
"create-docs": "pnpm run create-options && babel-node ./src/bin/generateDocs.js",
|
|
151
146
|
"create-rule": "babel-node ./src/bin/generateRule.js",
|
|
152
147
|
"create-options": "node ./src/bin/generateOptions.mjs",
|
|
153
148
|
"install-offline": "pnpm install --prefer-offline --no-audit",
|
|
154
|
-
"lint": "
|
|
155
|
-
"lint-
|
|
156
|
-
"lint-fix": "npm run lint-arg -- --fix .",
|
|
149
|
+
"lint": "eslint",
|
|
150
|
+
"lint-fix": "eslint --fix",
|
|
157
151
|
"prepare": "husky",
|
|
158
|
-
"test-no-cov": "
|
|
159
|
-
"test": "c8
|
|
160
|
-
"test-cov": "
|
|
161
|
-
"test-index": "
|
|
152
|
+
"test-no-cov": "BABEL_ENV=test mocha",
|
|
153
|
+
"test": "c8 pnpm run test-no-cov",
|
|
154
|
+
"test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
|
|
155
|
+
"test-index": "pnpm run test-no-cov test/rules/index.js"
|
|
162
156
|
},
|
|
163
|
-
"version": "52.0.
|
|
157
|
+
"version": "52.0.2"
|
|
164
158
|
}
|
|
@@ -16,6 +16,17 @@ import {
|
|
|
16
16
|
join,
|
|
17
17
|
} from 'node:path';
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @import {
|
|
21
|
+
* Integer,
|
|
22
|
+
* JsdocBlockWithInline,
|
|
23
|
+
* } from './iterateJsdoc.js';
|
|
24
|
+
* @import {
|
|
25
|
+
* ESLint,
|
|
26
|
+
* Linter,
|
|
27
|
+
* } from 'eslint';
|
|
28
|
+
*/
|
|
29
|
+
|
|
19
30
|
const {
|
|
20
31
|
version,
|
|
21
32
|
} = JSON.parse(
|
|
@@ -43,7 +54,7 @@ const escapeStringRegexp = (str) => {
|
|
|
43
54
|
/**
|
|
44
55
|
* @param {string} str
|
|
45
56
|
* @param {string} ch
|
|
46
|
-
* @returns {
|
|
57
|
+
* @returns {Integer}
|
|
47
58
|
*/
|
|
48
59
|
const countChars = (str, ch) => {
|
|
49
60
|
return (str.match(new RegExp(escapeStringRegexp(ch), 'gv')) || []).length;
|
|
@@ -52,8 +63,8 @@ const countChars = (str, ch) => {
|
|
|
52
63
|
/**
|
|
53
64
|
* @param {string} text
|
|
54
65
|
* @returns {[
|
|
55
|
-
*
|
|
56
|
-
*
|
|
66
|
+
* Integer,
|
|
67
|
+
* Integer
|
|
57
68
|
* ]}
|
|
58
69
|
*/
|
|
59
70
|
const getLinesCols = (text) => {
|
|
@@ -95,6 +106,7 @@ const getLinesCols = (text) => {
|
|
|
95
106
|
* We use a function for the ability of the user to pass in a config, but
|
|
96
107
|
* without requiring all users of the plugin to do so.
|
|
97
108
|
* @param {JsdocProcessorOptions} [options]
|
|
109
|
+
* @returns {ESLint.Plugin}
|
|
98
110
|
*/
|
|
99
111
|
export const getJsdocProcessorPlugin = (options = {}) => {
|
|
100
112
|
const {
|
|
@@ -150,7 +162,7 @@ export const getJsdocProcessorPlugin = (options = {}) => {
|
|
|
150
162
|
let extraMessages = [];
|
|
151
163
|
|
|
152
164
|
/**
|
|
153
|
-
* @param {
|
|
165
|
+
* @param {JsdocBlockWithInline} jsdoc
|
|
154
166
|
* @param {string} jsFileName
|
|
155
167
|
* @param {[number, number]} commentLineCols
|
|
156
168
|
*/
|
|
@@ -170,19 +182,19 @@ export const getJsdocProcessorPlugin = (options = {}) => {
|
|
|
170
182
|
* source: string,
|
|
171
183
|
* targetTagName: string,
|
|
172
184
|
* rules?: import('eslint').Linter.RulesRecord|undefined,
|
|
173
|
-
* lines?:
|
|
174
|
-
* cols?:
|
|
185
|
+
* lines?: Integer,
|
|
186
|
+
* cols?: Integer,
|
|
175
187
|
* skipInit?: boolean,
|
|
176
188
|
* ext: string,
|
|
177
189
|
* sources?: {
|
|
178
|
-
* nonJSPrefacingCols:
|
|
179
|
-
* nonJSPrefacingLines:
|
|
190
|
+
* nonJSPrefacingCols: Integer,
|
|
191
|
+
* nonJSPrefacingLines: Integer,
|
|
180
192
|
* string: string,
|
|
181
193
|
* }[],
|
|
182
194
|
* tag?: import('comment-parser').Spec & {
|
|
183
|
-
* line?:
|
|
195
|
+
* line?: Integer,
|
|
184
196
|
* }|{
|
|
185
|
-
* line:
|
|
197
|
+
* line: Integer,
|
|
186
198
|
* }
|
|
187
199
|
* }} cfg
|
|
188
200
|
*/
|
|
@@ -210,8 +222,8 @@ export const getJsdocProcessorPlugin = (options = {}) => {
|
|
|
210
222
|
|
|
211
223
|
/**
|
|
212
224
|
* @param {{
|
|
213
|
-
* nonJSPrefacingCols:
|
|
214
|
-
* nonJSPrefacingLines:
|
|
225
|
+
* nonJSPrefacingCols: Integer,
|
|
226
|
+
* nonJSPrefacingLines: Integer,
|
|
215
227
|
* string: string
|
|
216
228
|
* }} cfg
|
|
217
229
|
*/
|
|
@@ -234,7 +246,7 @@ export const getJsdocProcessorPlugin = (options = {}) => {
|
|
|
234
246
|
// NOTE: `tag.line` can be 0 if of form `/** @tag ... */`
|
|
235
247
|
const codeStartLine = /**
|
|
236
248
|
* @type {import('comment-parser').Spec & {
|
|
237
|
-
* line:
|
|
249
|
+
* line: Integer,
|
|
238
250
|
* }}
|
|
239
251
|
*/ (tag).line + nonJSPrefacingLines;
|
|
240
252
|
const codeStartCol = likelyNestedJSDocIndentSpace;
|
|
@@ -567,6 +579,7 @@ export const getJsdocProcessorPlugin = (options = {}) => {
|
|
|
567
579
|
/**
|
|
568
580
|
* @param {string} text
|
|
569
581
|
* @param {string} filename
|
|
582
|
+
* @returns {(string | Linter.ProcessorFile)[]}
|
|
570
583
|
*/
|
|
571
584
|
preprocess (text, filename) {
|
|
572
585
|
try {
|
|
@@ -634,7 +647,14 @@ export const getJsdocProcessorPlugin = (options = {}) => {
|
|
|
634
647
|
filename,
|
|
635
648
|
commentLineCols[idx],
|
|
636
649
|
);
|
|
637
|
-
}).filter(
|
|
650
|
+
}).filter(
|
|
651
|
+
/**
|
|
652
|
+
* @returns {file is Linter.ProcessorFile}
|
|
653
|
+
*/
|
|
654
|
+
(file) => {
|
|
655
|
+
return file !== null && file !== undefined;
|
|
656
|
+
},
|
|
657
|
+
),
|
|
638
658
|
];
|
|
639
659
|
/* c8 ignore next 6 */
|
|
640
660
|
} catch (error) {
|
package/eslint.config.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import jsdoc from './src/index.js';
|
|
2
|
-
import {
|
|
3
|
-
recommended as canonical,
|
|
4
|
-
} from 'eslint-config-canonical/canonical';
|
|
5
|
-
import {
|
|
6
|
-
recommended as canonicalJsdoc,
|
|
7
|
-
} from 'eslint-config-canonical/jsdoc';
|
|
8
|
-
import globals from 'globals';
|
|
9
|
-
|
|
10
|
-
const common = {
|
|
11
|
-
linterOptions: {
|
|
12
|
-
reportUnusedDisableDirectives: 'off',
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default [
|
|
17
|
-
...canonical,
|
|
18
|
-
...canonicalJsdoc,
|
|
19
|
-
...jsdoc.configs['examples-and-default-expressions'],
|
|
20
|
-
{
|
|
21
|
-
// Must be by itself
|
|
22
|
-
ignores: [
|
|
23
|
-
'dist/**', '.ignore/**', '**/*.d.ts',
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
...common,
|
|
28
|
-
languageOptions: {
|
|
29
|
-
ecmaVersion: 'latest',
|
|
30
|
-
globals: globals.node,
|
|
31
|
-
sourceType: 'module',
|
|
32
|
-
},
|
|
33
|
-
rules: {
|
|
34
|
-
'@stylistic/array-element-newline': 0,
|
|
35
|
-
'@stylistic/no-extra-parens': 0,
|
|
36
|
-
'filenames/match-regex': 0,
|
|
37
|
-
'import/extensions': 0,
|
|
38
|
-
'import/no-useless-path-segments': 0,
|
|
39
|
-
'linebreak-style': 0,
|
|
40
|
-
'no-inline-comments': 0,
|
|
41
|
-
'prefer-named-capture-group': 0,
|
|
42
|
-
'require-unicode-regexp': [
|
|
43
|
-
'error',
|
|
44
|
-
{
|
|
45
|
-
requireFlag: 'v',
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
'unicorn/import-index': 0,
|
|
49
|
-
'unicorn/no-array-reduce': 0,
|
|
50
|
-
'unicorn/no-unsafe-regex': 0,
|
|
51
|
-
'unicorn/prefer-array-some': 0,
|
|
52
|
-
'unicorn/prevent-abbreviations': 0,
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
...common,
|
|
57
|
-
files: [
|
|
58
|
-
'.ncurc.cjs',
|
|
59
|
-
],
|
|
60
|
-
languageOptions: {
|
|
61
|
-
parserOptions: {
|
|
62
|
-
ecmaFeatures: {
|
|
63
|
-
impliedStrict: false,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
sourceType: 'script',
|
|
67
|
-
},
|
|
68
|
-
rules: {
|
|
69
|
-
'canonical/filename-match-regex': 0,
|
|
70
|
-
'import/no-commonjs': 0,
|
|
71
|
-
strict: [
|
|
72
|
-
'error',
|
|
73
|
-
'global',
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
...common,
|
|
79
|
-
files: [
|
|
80
|
-
'test/**/*.js',
|
|
81
|
-
],
|
|
82
|
-
languageOptions: {
|
|
83
|
-
ecmaVersion: 'latest',
|
|
84
|
-
globals: globals.mocha,
|
|
85
|
-
sourceType: 'module',
|
|
86
|
-
},
|
|
87
|
-
rules: {
|
|
88
|
-
'no-restricted-syntax': 0,
|
|
89
|
-
'unicorn/prevent-abbreviations': 0,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
];
|
package/pnpm-workspace.yaml
DELETED