-
-
Notifications
You must be signed in to change notification settings - Fork 75
Parser does not handle jsdoc well #118
Comments
In fact, if you replace:
with:
|
Probably related to #5 |
@nzakas if you don't mind, I think I may have a fix for this and a way to attributing all comment nodes (single line, multiline and jsdoc) as mentioned by @JamesHenry in #5. I think this will enable rules like valid-jsdoc and others... Code is done, but I'm still working on the tests, so give me a couple of days and I will send a PR. |
Thanks for the suggestion, @weirdpattern! You must have missed the resolution in that issue #5 (comment) - comment attribution will be done in an upcoming version of ESLint, not in this project, nor any other other future parsers. |
@JamesHenry But we still need to identify the comments and convert them to ESTree nodes, right? Maybe I misunderstood the whole thing and did a terrible job at explaining what the code actually does. The code identifies and converts comments in typescript to ESTree nodes, which is responsibility of the parser if I'm not mistaken. Let me know if this is still something we don't need and I will just move on to a different issue =) |
Yes, comments will still need to be converted and included in the top level comments array, so I think we still need this fixed. |
ok, then give me a couple of days to complete the unit tests, then I will submit a PR for you to review... |
@weirdpattern The logic to scan for and convert comments was already added here typescript-eslint-parser/parser.js Lines 184 to 212 in 41ccef5
We currently have old espree test fixtures within attach-comments, but I think it might be best to wait until the comment attribution support lands in ESLint 4, before attempting to finalise how and what we test in this parser. Many thanks for your offer to contribute, it is always welcome! |
Makes sense, let's wait for eslint 4 to be released, then we can discuss. thanks for taking the time to answer my questions =) |
This is not actually a bug in the currently supported logic (TypeScript 2.0.x). This is an issue that applies to supporting 2.1.x, which is now being worked on in #128 Closing this issue in favour of that one, particularly to avoid the confusion with comment attribution, which is a totally separate issue. |
What version of TypeScript are you using?
2.1.1
What version of
typescript-eslint-parser
are you using?1.0.0
What code were you trying to parse?
What did you expect to happen?
Syntax should parse correctly
What happened?
Stacktrace:
Note: If you remove the
jsdoc
comments,eslint
does not crash anymore.The text was updated successfully, but these errors were encountered: