-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Docs: move custom parsers docs into a page (fixes #9919) #10431
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small cleanup opportunities here-- otherwise LGTM and a much needed reorganization. Thanks for contributing!
@@ -0,0 +1,72 @@ | |||
# Working with Custom Parsers | |||
|
|||
If you want to use your own parser and provide additional capabilities for your rules, you can specify your own custom parser. If a `parseForESLint` method is exposed on the parser, this method will be used to parse the code. Otherwise, the `parse` method will be used. Both methods should take in the source code as the first argument, and an optional configuration object as the second argument (provided as `parserOptions` in a config file). The `parse` method should simply return the AST. The `parseForESLint` method should return an object that contains the required property `ast` and an optional properties `services`, `scopeManager`, and `visitorKeys`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you didn't introduce this, but since we're moving the docs, let's clean them up a bit.
In the following segment:
The `parseForESLint` method should return an object that contains the required property `ast` and an optional properties `services`, `scopeManager`, and `visitorKeys`.
Can you please remove the "an" before "optional properties"? Thanks!
You can find an ESLint parser project [here](https://github.com/eslint/typescript-eslint-parser). | ||
|
||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to de-indent this block, remove this empty line break, and surround the whole thing in a json code block.
Updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
What is the purpose of this pull request? (put an "X" next to item)
[x] Documentation update
What changes did you make? (Give an overview)
move custom parsers docs into a page
Fixes #9919