We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! First of all, thanks for your job :)
Following up #145 I may have spotted a similar EOL problem on comment blocks:
The following test succeed (note the CR as EOL):
it('parsed.ast.comments // succeeding with CR', () => { 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: '@typescript-eslint/parser', }); expect(parsed.ast.comments[0].value).to.equal( '*\r\n' + ' * @description TESTSTETSTST\r\n' + ' * @param {string} arg - lorem\r\n' + ' * @return {string} - someDescription\r\n' + ' ', ); });
The following test fails (note the LF as EOL):
it('parsed.ast.comments // failing with LF', () => { const parsed = parseForESLint(`\n <template>\n <div>HELLO WORLD</div>\n </template>\n \n <script>\n export default {\n computed: {\n /**\n * @description TESTSTETSTST\n * @param {string} arg - lorem\n * @return {string} - someDescription\n */\n isForTestingLint (arg) {\n return arg;\n },\n },\n };\n </script>\n `, { parser: '@typescript-eslint/parser', }); expect(parsed.ast.comments[0].value).to.equal( '*\r\n' + ' * @description TESTSTETSTST\r\n' + ' * @param {string} arg - lorem\r\n' + ' * @return {string} - someDescription\r\n' + ' ', ); });
I would expect the content of parsed.ast.comments[0].value to be
parsed.ast.comments[0].value
'*\r\n' + ' * @description TESTSTETSTST\r\n' + ' * @param {string} arg - lorem\r\n' + ' * @return {string} - someDescription\r\n' + ' ',
Instead I'm having
'*\n\n' + ' * @description TESTSTETSTST\n\n' + ' * @param {string} arg - lorem\n\n' + ' * @return {string} - someDescription\n\n' + ' ',
For your information, the same unexpected behavior is obtained when using CRLF as EOL The following code:
parseForESLint(`\r\n <template>\r\n <div>HELLO WORLD</div>\r\n </template>\r\n \r\n <script>\r\n export default {\r\n computed: {\r\n /**\r\n * @description TESTSTETSTST\r\n * @param {string} arg - lorem\r\n * @return {string} - someDescription\r\n */\r\n isForTestingLint (arg) {\r\n return arg;\r\n },\r\n },\r\n };\r\n </script>\r\n `, { parser: '@typescript-eslint/parser', });
would produce
'*\r\n\n' + ' * @description TESTSTETSTST\r\n\n' + ' * @param {string} arg - lorem\r\n\n' + ' * @return {string} - someDescription\r\n\n' + ' ',
From what I observe, the following rules are true:
CR turns into CRLF LF turns into LF + LF CRLF turns into CRLF + LF
CR
CRLF
LF
Is this the expected behavior?
Thanks in advance for your time
The text was updated successfully, but these errors were encountered:
If I understand what you say, I think the parser is working right. Check the result of actually running the template literal.
JSON.stringify(`\r\n <template>\r\n <div>HELLO WORLD</div>\r\n </template>\r\n \r\n <script>\r\n export default {\r\n computed: {\r\n /**\r\n * @description TESTSTETSTST\r\n * @param {string} arg - lorem\r\n * @return {string} - someDescription\r\n */\r\n isForTestingLint (arg) {\r\n return arg;\r\n },\r\n },\r\n };\r\n </script>\r\n `)
Sorry, something went wrong.
No branches or pull requests
Hi!
First of all, thanks for your job :)
Following up #145 I may have spotted a similar EOL problem on comment blocks:
Premises
The following test succeed (note the CR as EOL):
The problem (?)
The following test fails (note the LF as EOL):
I would expect the content of
parsed.ast.comments[0].value
to beInstead I'm having
For your information, the same unexpected behavior is obtained when using CRLF as EOL
The following code:
would produce
The question
From what I observe, the following rules are true:
CR
turns intoCRLF
LF
turns intoLF
+LF
CRLF
turns intoCRLF
+LF
Is this the expected behavior?
Thanks in advance for your time
The text was updated successfully, but these errors were encountered: