Content-Length: 515398 | pFad | https://github.com/eslint/eslint/pull/18790

B8 refactor: Extract parsing logic from Linter by nzakas · Pull Request #18790 · eslint/eslint · GitHub
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

refactor: Extract parsing logic from Linter #18790

Merged
merged 4 commits into from
Aug 23, 2024
Merged

refactor: Extract parsing logic from Linter #18790

merged 4 commits into from
Aug 23, 2024

Conversation

nzakas
Copy link
Member

@nzakas nzakas commented Aug 19, 2024

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:

Refactor

What changes did you make? (Give an overview)

Extracted the parsing logic from Linter into a new class, ParserService. I envision this as a step towards the core rewrite, where the API is made up of smaller classes rather than giant ones that do everything.

Notes:

  • I anticipate there being constructor arguments to this class in the future, which is why it's a class rather than a function.
  • I also anticipate having an asynchronous parse() method, which is why I've named this method parseSync() for clarity.
  • I named the class "ParserService" to distinguish it from parsers like Espree.

refs #18787

Is there anything you'd like reviewers to focus on?

@nzakas nzakas requested a review from a team as a code owner August 19, 2024 15:51
@eslint-github-bot eslint-github-bot bot added the chore This change is not user-facing label Aug 19, 2024
@github-actions github-actions bot added the core Relates to ESLint's core APIs and features label Aug 19, 2024
Copy link

netlify bot commented Aug 19, 2024

Deploy Preview for docs-eslint ready!

Name Link
🔨 Latest commit 395f2d9
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/66c75a24f696da0008a93da8
😎 Deploy Preview https://deploy-preview-18790--docs-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mdjermanovic mdjermanovic added the accepted There is consensus among the team that this change meets the criteria for inclusion label Aug 21, 2024
lib/linter/linter.js Outdated Show resolved Hide resolved
lib/services/parser-service.js Outdated Show resolved Hide resolved
nzakas and others added 2 commits August 22, 2024 11:32
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Copy link
Member

@mdjermanovic mdjermanovic 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!

@mdjermanovic mdjermanovic merged commit e112642 into main Aug 23, 2024
19 checks passed
@mdjermanovic mdjermanovic deleted the parser-service branch August 23, 2024 07:11
Vylpes pushed a commit to Vylpes/random-bunny that referenced this pull request Sep 2, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@eslint/js](https://eslint.org) ([source](https://github.com/eslint/eslint/tree/HEAD/packages/js)) | devDependencies | minor | [`9.8.0` -> `9.9.1`](https://renovatebot.com/diffs/npm/@eslint%2fjs/9.8.0/9.9.1) |

---

### Release Notes

<details>
<summary>eslint/eslint (@&#8203;eslint/js)</summary>

### [`v9.9.1`](https://github.com/eslint/eslint/releases/tag/v9.9.1)

[Compare Source](eslint/eslint@v9.9.0...v9.9.1)

#### Bug Fixes

-   [`9bde90c`](eslint/eslint@9bde90c) fix: add logic to handle `fixTypes` in `lintText()` ([#&#8203;18736](eslint/eslint#18736)) (Amaresh  S M)

#### Documentation

-   [`4840930`](eslint/eslint@4840930) docs: Update README with version support and clean up content ([#&#8203;18804](eslint/eslint#18804)) (Nicholas C. Zakas)
-   [`f61f40d`](eslint/eslint@f61f40d) docs: Update globals examples ([#&#8203;18805](eslint/eslint#18805)) (Nicholas C. Zakas)
-   [`241fcea`](eslint/eslint@241fcea) docs: Use and define languages ([#&#8203;18795](eslint/eslint#18795)) (Nicholas C. Zakas)
-   [`5dbdd63`](eslint/eslint@5dbdd63) docs: eslint-plugin-markdown -> [@&#8203;eslint/markdown](https://github.com/eslint/markdown) ([#&#8203;18797](eslint/eslint#18797)) (Nicholas C. Zakas)
-   [`c6c8ddd`](eslint/eslint@c6c8ddd) docs: update links to eslint-visitor-keys repo ([#&#8203;18796](eslint/eslint#18796)) (Francesco Trotta)
-   [`f981d05`](eslint/eslint@f981d05) docs: Update README (GitHub Actions Bot)
-   [`b516974`](eslint/eslint@b516974) docs: update links to `eslint/js` repo ([#&#8203;18781](eslint/eslint#18781)) (Francesco Trotta)
-   [`fb7a3f5`](eslint/eslint@fb7a3f5) docs: update note for package managers ([#&#8203;18779](eslint/eslint#18779)) (Jay)

#### Chores

-   [`b0c34d0`](eslint/eslint@b0c34d0) chore: upgrade to [@&#8203;eslint/js](https://github.com/eslint/js)[@&#8203;9](https://github.com/9).9.1 ([#&#8203;18809](eslint/eslint#18809)) (Francesco Trotta)
-   [`cd5a0da`](eslint/eslint@cd5a0da) chore: package.json update for [@&#8203;eslint/js](https://github.com/eslint/js) release (Jenkins)
-   [`e112642`](eslint/eslint@e112642) refactor: Extract parsing logic from Linter ([#&#8203;18790](eslint/eslint#18790)) (Nicholas C. Zakas)
-   [`0f68a85`](eslint/eslint@0f68a85) chore: use eslint-plugin-yml on yaml files only ([#&#8203;18801](eslint/eslint#18801)) (Milos Djermanovic)
-   [`f8d1b3c`](eslint/eslint@f8d1b3c) chore: update dependencies for browser tests ([#&#8203;18794](eslint/eslint#18794)) (Christian Bromann)
-   [`aed2624`](eslint/eslint@aed2624) chore: update dependency [@&#8203;eslint/config-array](https://github.com/eslint/config-array) to ^0.18.0 ([#&#8203;18788](eslint/eslint#18788)) (renovate\[bot])
-   [`5c29128`](eslint/eslint@5c29128) chore: update dependency [@&#8203;eslint/core](https://github.com/eslint/core) to ^0.4.0 ([#&#8203;18789](eslint/eslint#18789)) (renovate\[bot])
-   [`5d66fb2`](eslint/eslint@5d66fb2) chore: migrate linting workflow to use trunk check meta-linter ([#&#8203;18643](eslint/eslint#18643)) (Chris Clearwater)
-   [`bf96855`](eslint/eslint@bf96855) chore: add ids to github issue templates ([#&#8203;18775](eslint/eslint#18775)) (Strek)

### [`v9.9.0`](https://github.com/eslint/eslint/releases/tag/v9.9.0)

[Compare Source](eslint/eslint@v9.8.0...v9.9.0)

#### Features

-   [`41d0206`](eslint/eslint@41d0206) feat: Add support for TS config files ([#&#8203;18134](eslint/eslint#18134)) (Arya Emami)
-   [`3a4eaf9`](eslint/eslint@3a4eaf9) feat: add suggestion to `require-await` to remove `async` keyword ([#&#8203;18716](eslint/eslint#18716)) (Dave)

#### Documentation

-   [`9fe068c`](eslint/eslint@9fe068c) docs: how to author plugins with configs that extend other configs ([#&#8203;18753](eslint/eslint#18753)) (Alec Gibson)
-   [`48117b2`](eslint/eslint@48117b2) docs: add version support page in the side navbar ([#&#8203;18738](eslint/eslint#18738)) (Amaresh  S M)
-   [`fec2951`](eslint/eslint@fec2951) docs: add version support page to the dropdown ([#&#8203;18730](eslint/eslint#18730)) (Amaresh  S M)
-   [`38a0661`](eslint/eslint@38a0661) docs: Fix typo ([#&#8203;18735](eslint/eslint#18735)) (Zaina Al Habash)
-   [`3c32a9e`](eslint/eslint@3c32a9e) docs: Update yarn command for creating ESLint config ([#&#8203;18739](eslint/eslint#18739)) (Temitope Ogunleye)
-   [`f9ac978`](eslint/eslint@f9ac978) docs: Update README (GitHub Actions Bot)

#### Chores

-   [`461b2c3`](eslint/eslint@461b2c3) chore: upgrade to `@eslint/js@9.9.0` ([#&#8203;18765](eslint/eslint#18765)) (Francesco Trotta)
-   [`59dba1b`](eslint/eslint@59dba1b) chore: package.json update for [@&#8203;eslint/js](https://github.com/eslint/js) release (Jenkins)
-   [`fea8563`](eslint/eslint@fea8563) chore: update dependency [@&#8203;eslint/core](https://github.com/eslint/core) to ^0.3.0 ([#&#8203;18724](eslint/eslint#18724)) (renovate\[bot])
-   [`aac191e`](eslint/eslint@aac191e) chore: update dependency [@&#8203;eslint/json](https://github.com/eslint/json) to ^0.3.0 ([#&#8203;18760](eslint/eslint#18760)) (renovate\[bot])
-   [`b97fa05`](eslint/eslint@b97fa05) chore: update wdio dependencies for more stable tests ([#&#8203;18759](eslint/eslint#18759)) (Christian Bromann)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjQzMS40IiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.vylpes.xyz/RabbitLabs/random-bunny/pulls/214
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
Vylpes pushed a commit to Vylpes/random-bunny that referenced this pull request Sep 10, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [eslint](https://eslint.org) ([source](https://github.com/eslint/eslint)) | devDependencies | minor | [`9.8.0` -> `9.10.0`](https://renovatebot.com/diffs/npm/eslint/9.8.0/9.10.0) |
| [@types/eslint](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/eslint) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/eslint)) | devDependencies | patch | [`9.6.0` -> `9.6.1`](https://renovatebot.com/diffs/npm/@types%2feslint/9.6.0/9.6.1) |

---

### Release Notes

<details>
<summary>eslint/eslint (eslint)</summary>

### [`v9.10.0`](https://github.com/eslint/eslint/releases/tag/v9.10.0)

[Compare Source](eslint/eslint@v9.9.1...v9.10.0)

#### Features

-   [`301b90d`](eslint/eslint@301b90d) feat: Add types ([#&#8203;18854](eslint/eslint#18854)) (Nicholas C. Zakas)
-   [`bcf0df5`](eslint/eslint@bcf0df5) feat: limit namespace import identifier in id-length rule ([#&#8203;18849](eslint/eslint#18849)) (ChaedongIm)
-   [`45c18e1`](eslint/eslint@45c18e1) feat: add `requireFlag` option to `require-unicode-regexp` rule ([#&#8203;18836](eslint/eslint#18836)) (Brett Zamir)
-   [`183b459`](eslint/eslint@183b459) feat: add error message for duplicate flags in `no-invalid-regexp` ([#&#8203;18837](eslint/eslint#18837)) (Tanuj Kanti)
-   [`c69b406`](eslint/eslint@c69b406) feat: report duplicate allowed flags in `no-invalid-regexp` ([#&#8203;18754](eslint/eslint#18754)) (Tanuj Kanti)

#### Documentation

-   [`bee0e7a`](eslint/eslint@bee0e7a) docs: update README ([#&#8203;18865](eslint/eslint#18865)) (Milos Djermanovic)
-   [`5d80b59`](eslint/eslint@5d80b59) docs: specify that `ruleId` can be `null` in custom formatter docs ([#&#8203;18857](eslint/eslint#18857)) (Milos Djermanovic)
-   [`156b1c3`](eslint/eslint@156b1c3) docs: Update README (GitHub Actions Bot)
-   [`f6fdef9`](eslint/eslint@f6fdef9) docs: Update README (GitHub Actions Bot)
-   [`a20c870`](eslint/eslint@a20c870) docs: Update README (GitHub Actions Bot)
-   [`90e699b`](eslint/eslint@90e699b) docs: Update README (GitHub Actions Bot)

#### Chores

-   [`24c3ff7`](eslint/eslint@24c3ff7) chore: upgrade to [@&#8203;eslint/js](https://github.com/eslint/js)[@&#8203;9](https://github.com/9).10.0 ([#&#8203;18866](eslint/eslint#18866)) (Francesco Trotta)
-   [`1ebdde1`](eslint/eslint@1ebdde1) chore: package.json update for [@&#8203;eslint/js](https://github.com/eslint/js) release (Jenkins)
-   [`e8fc5bd`](eslint/eslint@e8fc5bd) chore: update dependency [@&#8203;eslint/core](https://github.com/eslint/core) to ^0.5.0 ([#&#8203;18848](eslint/eslint#18848)) (renovate\[bot])
-   [`343f992`](eslint/eslint@343f992) refactor: don't use `node.value` when removing unused directives ([#&#8203;18835](eslint/eslint#18835)) (Milos Djermanovic)
-   [`3db18b0`](eslint/eslint@3db18b0) refactor: Extract FileContext into class ([#&#8203;18831](eslint/eslint#18831)) (Nicholas C. Zakas)
-   [`931d650`](eslint/eslint@931d650) refactor: Use [@&#8203;eslint/plugin-kit](https://github.com/eslint/plugin-kit) ([#&#8203;18822](eslint/eslint#18822)) (Nicholas C. Zakas)
-   [`ed5cf0c`](eslint/eslint@ed5cf0c) chore: update dependency [@&#8203;eslint/json](https://github.com/eslint/json) to ^0.4.0 ([#&#8203;18829](eslint/eslint#18829)) (Milos Djermanovic)
-   [`d1f0831`](eslint/eslint@d1f0831) chore: added missing ids ([#&#8203;18817](eslint/eslint#18817)) (Strek)
-   [`ec92813`](eslint/eslint@ec92813) refactor: Config class ([#&#8203;18763](eslint/eslint#18763)) (Nicholas C. Zakas)

### [`v9.9.1`](https://github.com/eslint/eslint/releases/tag/v9.9.1)

[Compare Source](eslint/eslint@v9.9.0...v9.9.1)

#### Bug Fixes

-   [`9bde90c`](eslint/eslint@9bde90c) fix: add logic to handle `fixTypes` in `lintText()` ([#&#8203;18736](eslint/eslint#18736)) (Amaresh  S M)

#### Documentation

-   [`4840930`](eslint/eslint@4840930) docs: Update README with version support and clean up content ([#&#8203;18804](eslint/eslint#18804)) (Nicholas C. Zakas)
-   [`f61f40d`](eslint/eslint@f61f40d) docs: Update globals examples ([#&#8203;18805](eslint/eslint#18805)) (Nicholas C. Zakas)
-   [`241fcea`](eslint/eslint@241fcea) docs: Use and define languages ([#&#8203;18795](eslint/eslint#18795)) (Nicholas C. Zakas)
-   [`5dbdd63`](eslint/eslint@5dbdd63) docs: eslint-plugin-markdown -> [@&#8203;eslint/markdown](https://github.com/eslint/markdown) ([#&#8203;18797](eslint/eslint#18797)) (Nicholas C. Zakas)
-   [`c6c8ddd`](eslint/eslint@c6c8ddd) docs: update links to eslint-visitor-keys repo ([#&#8203;18796](eslint/eslint#18796)) (Francesco Trotta)
-   [`f981d05`](eslint/eslint@f981d05) docs: Update README (GitHub Actions Bot)
-   [`b516974`](eslint/eslint@b516974) docs: update links to `eslint/js` repo ([#&#8203;18781](eslint/eslint#18781)) (Francesco Trotta)
-   [`fb7a3f5`](eslint/eslint@fb7a3f5) docs: update note for package managers ([#&#8203;18779](eslint/eslint#18779)) (Jay)

#### Chores

-   [`b0c34d0`](eslint/eslint@b0c34d0) chore: upgrade to [@&#8203;eslint/js](https://github.com/eslint/js)[@&#8203;9](https://github.com/9).9.1 ([#&#8203;18809](eslint/eslint#18809)) (Francesco Trotta)
-   [`cd5a0da`](eslint/eslint@cd5a0da) chore: package.json update for [@&#8203;eslint/js](https://github.com/eslint/js) release (Jenkins)
-   [`e112642`](eslint/eslint@e112642) refactor: Extract parsing logic from Linter ([#&#8203;18790](eslint/eslint#18790)) (Nicholas C. Zakas)
-   [`0f68a85`](eslint/eslint@0f68a85) chore: use eslint-plugin-yml on yaml files only ([#&#8203;18801](eslint/eslint#18801)) (Milos Djermanovic)
-   [`f8d1b3c`](eslint/eslint@f8d1b3c) chore: update dependencies for browser tests ([#&#8203;18794](eslint/eslint#18794)) (Christian Bromann)
-   [`aed2624`](eslint/eslint@aed2624) chore: update dependency [@&#8203;eslint/config-array](https://github.com/eslint/config-array) to ^0.18.0 ([#&#8203;18788](eslint/eslint#18788)) (renovate\[bot])
-   [`5c29128`](eslint/eslint@5c29128) chore: update dependency [@&#8203;eslint/core](https://github.com/eslint/core) to ^0.4.0 ([#&#8203;18789](eslint/eslint#18789)) (renovate\[bot])
-   [`5d66fb2`](eslint/eslint@5d66fb2) chore: migrate linting workflow to use trunk check meta-linter ([#&#8203;18643](eslint/eslint#18643)) (Chris Clearwater)
-   [`bf96855`](eslint/eslint@bf96855) chore: add ids to github issue templates ([#&#8203;18775](eslint/eslint#18775)) (Strek)

### [`v9.9.0`](https://github.com/eslint/eslint/releases/tag/v9.9.0)

[Compare Source](eslint/eslint@v9.8.0...v9.9.0)

#### Features

-   [`41d0206`](eslint/eslint@41d0206) feat: Add support for TS config files ([#&#8203;18134](eslint/eslint#18134)) (Arya Emami)
-   [`3a4eaf9`](eslint/eslint@3a4eaf9) feat: add suggestion to `require-await` to remove `async` keyword ([#&#8203;18716](eslint/eslint#18716)) (Dave)

#### Documentation

-   [`9fe068c`](eslint/eslint@9fe068c) docs: how to author plugins with configs that extend other configs ([#&#8203;18753](eslint/eslint#18753)) (Alec Gibson)
-   [`48117b2`](eslint/eslint@48117b2) docs: add version support page in the side navbar ([#&#8203;18738](eslint/eslint#18738)) (Amaresh  S M)
-   [`fec2951`](eslint/eslint@fec2951) docs: add version support page to the dropdown ([#&#8203;18730](eslint/eslint#18730)) (Amaresh  S M)
-   [`38a0661`](eslint/eslint@38a0661) docs: Fix typo ([#&#8203;18735](eslint/eslint#18735)) (Zaina Al Habash)
-   [`3c32a9e`](eslint/eslint@3c32a9e) docs: Update yarn command for creating ESLint config ([#&#8203;18739](eslint/eslint#18739)) (Temitope Ogunleye)
-   [`f9ac978`](eslint/eslint@f9ac978) docs: Update README (GitHub Actions Bot)

#### Chores

-   [`461b2c3`](eslint/eslint@461b2c3) chore: upgrade to `@eslint/js@9.9.0` ([#&#8203;18765](eslint/eslint#18765)) (Francesco Trotta)
-   [`59dba1b`](eslint/eslint@59dba1b) chore: package.json update for [@&#8203;eslint/js](https://github.com/eslint/js) release (Jenkins)
-   [`fea8563`](eslint/eslint@fea8563) chore: update dependency [@&#8203;eslint/core](https://github.com/eslint/core) to ^0.3.0 ([#&#8203;18724](eslint/eslint#18724)) (renovate\[bot])
-   [`aac191e`](eslint/eslint@aac191e) chore: update dependency [@&#8203;eslint/json](https://github.com/eslint/json) to ^0.3.0 ([#&#8203;18760](eslint/eslint#18760)) (renovate\[bot])
-   [`b97fa05`](eslint/eslint@b97fa05) chore: update wdio dependencies for more stable tests ([#&#8203;18759](eslint/eslint#18759)) (Christian Bromann)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjQzMS40IiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.vylpes.xyz/RabbitLabs/random-bunny/pulls/215
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion chore This change is not user-facing core Relates to ESLint's core APIs and features
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/eslint/eslint/pull/18790

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy