Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Parse comments #158

New issue

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

Closed
mohsen1 opened this issue Jan 29, 2019 · 7 comments
Closed

Parse comments #158

mohsen1 opened this issue Jan 29, 2019 · 7 comments
Labels
package: typescript-estree Issues related to @typescript-eslint/typescript-estree

Comments

@mohsen1
Copy link
Contributor

mohsen1 commented Jan 29, 2019

I want to be able to write a rule that warns against unnecessary @ts-ignore comments

What code were you trying to parse?

// @ts-ignore
var foo: string = 1

What did you expect to happen?
Like Babylon or Flow parsers, emit a list of comments next to list of statements

What actually happened?
No comments list is emitted

Versions
Tried in AST Explorer

package version
@typescript-eslint/parser 1.1.0
@mohsen1 mohsen1 added package: parser Issues related to @typescript-eslint/parser triage Waiting for team members to take a look labels Jan 29, 2019
@armano2 armano2 added package: typescript-estree Issues related to @typescript-eslint/typescript-estree enhancement New feature or request and removed package: parser Issues related to @typescript-eslint/parser triage Waiting for team members to take a look labels Jan 29, 2019
@kaicataldo
Copy link
Member

@mohsen1 To clarify, are you asking for a top-level comments array? If so, this parser does do that. If you're testing in AST Explorer you need to click the cog and enable comment.

@kaicataldo
Copy link
Member

To clarify, this is only necessary when using the parser directly - ESLint will already enable this flag in its config at parse time.

@JamesHenry JamesHenry removed the enhancement New feature or request label Jan 29, 2019
@JamesHenry
Copy link
Member

Thanks Kai, that should fix your issue @mohsen1

@armano2

This comment has been minimized.

@JamesHenry
Copy link
Member

@armano2 ESLint performs the comment attribution

@kaicataldo
Copy link
Member

kaicataldo commented Jan 29, 2019

@armano2 For ESLint's purposes, comment attachment is no longer used and has been deprecated since ESLint v4. Unless there's another use for that feature, I don't think it's needed here. And having worked with comment attachment a lot at this point, I recommend not going down that rabbit hole!

@armano2
Copy link
Collaborator

armano2 commented Jan 29, 2019

yup, i got this information already, as @JamesHenry pointed out eslint/js@1bcd563

@typescript-eslint typescript-eslint locked as resolved and limited conversation to collaborators Feb 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Projects
None yet
Development

No branches or pull requests

4 participants