Description
Hi,
Our users for eslint-plugin-jsdoc
have reported problems with Vue in passing on preserving newlines within the ESLint AST comments
property when carriage returns are also present (preceding them).
I've confirmed that @babel/eslint-parser
does not strip the newlines when interpreting the text within the user's <script>
tag, but when supplying the text to vue-eslint-parser
, though the carriage returns our preserved, the newlines are stripped, producing comment AST like the following, causing our plugin to report errors when there should be none:
[
{
type: 'Block',
value: '*\r * @description TESTSTETSTST\r * @param {string} arg - lorem\r * @return {string} - someDescription\r ',
// ...
}
]
However, I see that in the likes of templateBody
AST, at least, instead of newlines being missing, the newlines are present (and the carriage returns are not added), as perhaps is expected. But for comments
, there is the above problem.
Code to reproduce (in a type: "module"
package):
import {parseForESLint} from 'vue-eslint-parser';
const parsed = parseForESLint(`\r
<template>\r
<div>HELLO WORLD</div>\r
</template>\r
\r
<script>\r
export default {\r
computed: {\r
/**\r
* @description TESTSTETSTST\r
* @param {string} arg - lorem\r
* @return {string} - someDescription\r
*/\r
isForTestingLint (arg) {\r
return arg;\r
},\r
},\r
};\r
</script>\r
`, {
parser: "@babel/eslint-parser"
})
console.log('parsed', parsed.ast.comments);