eslint-plugin-jsdoc 52.0.1 → 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 +4 -29
- package/dist/getJsdocProcessorPlugin.d.ts.map +1 -1
- package/package.json +11 -17
- package/src/getJsdocProcessorPlugin.js +34 -14
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,SAAAU,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAZ,CAAA,UAA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AC;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(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"],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,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,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAA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AAC,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,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK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,QAAQ,CAAE3C,IAAI,CAAC2C,OAAO,CAACK,KAAK,CAAC;YACvC,CAAC,CAAC,CAACC,GAAG,CAAEN,OAAO,IAAK;cAClB,MAAM,CACJO;cACA,sDACD,GAAGP,OAAO,CAACQ,KAAK,IAAI,EAAE;cACvB,MAAMC,WAAW,GAAG5H,IAAI,CAACG,KAAK,CAAC,CAAC,EAAEuH,KAAK,CAAC;cAExC,MAAM,CACJpF,KAAK,EACLJ,IAAI,CACL,GAAGnC,YAAY,CAAC6H,WAAW,CAAC;;cAE7B;cACA;cACA;cACA;cACA;cACA7F,eAAe,CAACc,IAAI,CAAC,CACnBP,KAAK,EAAEJ,IAAI,CACZ,CAAC;cACF,OAAO,IAAA2F,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;YACP;AAChB;AACA;YACiBpE,IAAI,IAAK;cACR,OAAOA,IAAI,KAAK,IAAI,IAAIA,IAAI,KAAK/B,SAAS;YAC5C,CACF,CAAC,CACF;YACH;UACA,CAAC,CAAC,OAAO2G,KAAK,EAAE;YACd;YACAC,OAAO,CAACC,GAAG,CAAC,KAAK,EAAE5F,QAAQ,EAAE0F,KAAK,CAAC;UACrC;UAEA,OAAO,EAAE;QACX,CAAC;QACD;QACAG,eAAe,EAAE;MACnB;IACF;EACF,CAAC;AACH,CAAC;AAACC,OAAA,CAAA9H,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -1,31 +1,4 @@
|
|
|
1
|
-
export function getJsdocProcessorPlugin(options?: JsdocProcessorOptions):
|
|
2
|
-
meta: {
|
|
3
|
-
name: string;
|
|
4
|
-
version: any;
|
|
5
|
-
};
|
|
6
|
-
processors: {
|
|
7
|
-
examples: {
|
|
8
|
-
meta: {
|
|
9
|
-
name: string;
|
|
10
|
-
version: any;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* @param {import('eslint').Linter.LintMessage[][]} messages
|
|
14
|
-
* @param {string} filename
|
|
15
|
-
*/
|
|
16
|
-
postprocess([jsMessages, ...messages]: import("eslint").Linter.LintMessage[][], filename: string): import("eslint").Linter.LintMessage[];
|
|
17
|
-
/**
|
|
18
|
-
* @param {string} text
|
|
19
|
-
* @param {string} filename
|
|
20
|
-
*/
|
|
21
|
-
preprocess(text: string, filename: string): (string | {
|
|
22
|
-
text: string;
|
|
23
|
-
filename: string | null | undefined;
|
|
24
|
-
})[];
|
|
25
|
-
supportsAutofix: boolean;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
};
|
|
1
|
+
export function getJsdocProcessorPlugin(options?: JsdocProcessorOptions): ESLint.Plugin;
|
|
29
2
|
export type Integer = number;
|
|
30
3
|
export type JsdocProcessorOptions = {
|
|
31
4
|
/**
|
|
@@ -87,6 +60,8 @@ export type JsdocProcessorOptions = {
|
|
|
87
60
|
/**
|
|
88
61
|
* See docs
|
|
89
62
|
*/
|
|
90
|
-
parser?:
|
|
63
|
+
parser?: Linter.ESTreeParser | Linter.NonESTreeParser | undefined;
|
|
91
64
|
};
|
|
65
|
+
import type { ESLint } from 'eslint';
|
|
66
|
+
import type { Linter } from 'eslint';
|
|
92
67
|
//# sourceMappingURL=getJsdocProcessorPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getJsdocProcessorPlugin.d.ts","sourceRoot":"","sources":["../src/getJsdocProcessorPlugin.js"],"names":[],"mappings":"
|
|
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"}
|
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) {
|