Skip to content
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

Merged
merged 1 commit into from
Jun 2, 2018
Merged

Docs: move custom parsers docs into a page (fixes #9919) #10431

merged 1 commit into from
Jun 2, 2018

Conversation

g-plane
Copy link
Member

@g-plane g-plane commented Jun 1, 2018

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

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Jun 1, 2018
@aladdin-add aladdin-add added enhancement This change enhances an existing feature of ESLint documentation Relates to ESLint's documentation accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Jun 1, 2018
Copy link
Member

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Copy link
Member

@platinumazure platinumazure left a 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`.
Copy link
Member

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).

{

Copy link
Member

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.

@g-plane
Copy link
Member Author

g-plane commented Jun 2, 2018

Updated.

Copy link
Member

@platinumazure platinumazure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@platinumazure platinumazure merged commit 1984c21 into eslint:master Jun 2, 2018
@g-plane g-plane deleted the docs-custom-parsers branch June 2, 2018 01:53
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Dec 1, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Dec 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion documentation Relates to ESLint's documentation enhancement This change enhances an existing feature of ESLint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants