eslint-plugin-jsdoc 65.3.5 → 65.3.7

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/package.json CHANGED
@@ -163,5 +163,5 @@
163
163
  "test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
164
164
  "test-index": "pnpm run test-no-cov test/rules/index.js"
165
165
  },
166
- "version": "65.3.5"
166
+ "version": "65.3.7"
167
167
  }
package/src/jsdocUtils.js CHANGED
@@ -1637,7 +1637,7 @@ const splitTopLevelCommas = (str) => {
1637
1637
  const parseClosureTemplateTag = (tag) => {
1638
1638
  return splitTopLevelCommas(tag.name)
1639
1639
  .map((type) => {
1640
- return type.trim().replace(/^\[?(?<name>.*?)=.*$/v, '$<name>');
1640
+ return type.trim().replace(/^\[?\s*(?<name>.*?)\s*=.*$/v, '$<name>');
1641
1641
  });
1642
1642
  };
1643
1643
 
@@ -77,6 +77,17 @@ export default iterateJsdoc(({
77
77
  */
78
78
  const createImportInserter = (importText) => {
79
79
  return (fixer) => {
80
+ // A hashbang (`#!`) must stay on the first line
81
+ const hashbang = (/^#!.*(?:\r\n|\n)/v).exec(sourceCode.text);
82
+ if (hashbang) {
83
+ return fixer.insertTextAfterRange(
84
+ [
85
+ 0, hashbang[0].length,
86
+ ],
87
+ `${importText}${hashbang[0].endsWith('\r\n') ? '\r\n' : '\n'}`,
88
+ );
89
+ }
90
+
80
91
  const programNode = sourceCode.ast;
81
92
  const commentNodes = sourceCode.getCommentsBefore(programNode);
82
93