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

fix: add logic to handle fixTypes in the lintText() #18736

Merged
merged 7 commits into from
Aug 13, 2024

Conversation

amareshsm
Copy link
Member

Prerequisites checklist

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

[ ] Documentation update
[x] 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
[ ] Other, please explain:

What changes did you make? (Give an overview)

fixes #18732

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

@amareshsm amareshsm requested a review from a team as a code owner July 31, 2024 21:05
@eslint-github-bot eslint-github-bot bot added the bug ESLint is working incorrectly label Jul 31, 2024
Copy link

netlify bot commented Jul 31, 2024

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 35729cf
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/66bb70f31b4981000867d122

@github-actions github-actions bot added cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features labels Jul 31, 2024
@fasttime fasttime added the accepted There is consensus among the team that this change meets the criteria for inclusion label Aug 1, 2024
@fasttime
Copy link
Member

fasttime commented Aug 1, 2024

Thanks for the PR! I think we need unit tests for this fix. The tests we currently have for fixTypes only call lintFiles(): https://github.com/eslint/eslint/blob/v9.8.0/tests/lib/eslint/eslint.js#L5114-L5170. We could simply add similar tests that call lintText().

@amareshsm
Copy link
Member Author

Thanks for the PR! I think we need unit tests for this fix. The tests we currently have for fixTypes only call lintFiles(): https://github.com/eslint/eslint/blob/v9.8.0/tests/lib/eslint/eslint.js#L5114-L5170. We could simply add similar tests that call lintText().

👍 I will add Unit tests.

@aladdin-add aladdin-add marked this pull request as draft August 6, 2024 06:34
@aladdin-add
Copy link
Member

it needs some tests, so converting to a draft to avoid it being merged by accident.

@amareshsm
Copy link
Member Author

UTs added for lintText() also.

@amareshsm amareshsm marked this pull request as ready for review August 12, 2024 13:03
tests/lib/eslint/eslint.js Outdated Show resolved Hide resolved
tests/lib/eslint/eslint.js Outdated Show resolved Hide resolved
Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

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

Thanks! This is looking good already. I just left a suggestion to remove a duplication.

lib/eslint/eslint.js Outdated Show resolved Hide resolved
lib/eslint/eslint.js Outdated Show resolved Hide resolved
Co-authored-by: Francesco Trotta <[email protected]>
Copy link
Member

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

@fasttime fasttime merged commit 9bde90c into main Aug 13, 2024
19 checks passed
@fasttime fasttime deleted the handle-fixType-in-lintText branch August 13, 2024 14:58
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/[email protected]` ([#&#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 <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
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/[email protected]` ([#&#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 <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
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 bug ESLint is working incorrectly cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features
Projects
Status: Complete
3 participants