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 +1 -1
- package/src/jsdocUtils.js +1 -1
- package/src/rules/preferImportTag.js +11 -0
package/package.json
CHANGED
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(/^\[
|
|
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
|
|