Skip to content

Add vitest globals#274

Merged
sindresorhus merged 3 commits intosindresorhus:mainfrom
yongholeeme:main
Dec 18, 2024
Merged

Add vitest globals#274
sindresorhus merged 3 commits intosindresorhus:mainfrom
yongholeeme:main

Conversation

@yongholeeme
Copy link
Copy Markdown
Contributor

@yongholeeme yongholeeme commented Dec 17, 2024

Hello @sindresorhus! I'm opening a PR to add vitest globals.

A similar PR was previously opened in #210, but it was closed due to the package's management policy at that time (as discussed in #82). However, since ESLint no longer bundles globals and new environments are now being added to the globals package, I believe it's appropriate to open this request.

I've added these by referencing the official Vitest globals definition file: https://github.com/vitest-dev/vitest/blob/main/packages/vitest/globals.d.ts.

Comment thread globals.json
@yongholeeme yongholeeme force-pushed the main branch 2 times, most recently from e8e811e to 1ef7d84 Compare December 17, 2024 10:35
@yongholeeme yongholeeme requested a review from fisker December 17, 2024 10:36
@fisker
Copy link
Copy Markdown
Collaborator

fisker commented Dec 17, 2024

As I tested, vitest package can't be imported, it seems there is no way to get those from vitest package, but vitest/globals contains types, is it possible to assert they are equal here https://github.com/sindresorhus/globals/blob/main/index.test-d.ts?

@yongholeeme
Copy link
Copy Markdown
Contributor Author

As I tested, vitest package can't be imported, it seems there is no way to get those from vitest package, but vitest/globals contains types, is it possible to assert they are equal here https://github.com/sindresorhus/globals/blob/main/index.test-d.ts?

@fisker, as you mentioned, vitest/globals contains types in globals.d.ts. However, since these are declared as global types, I think it's difficult to assert their equality.

@yongholeeme
Copy link
Copy Markdown
Contributor Author

yongholeeme commented Dec 17, 2024

@fisker, I've updated the way of generating vitest globals by using @vitest/eslint-plugin (see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/src/index.ts#L269-L285). However, it's not identical to vitest/globals. As this is the official package, I think this approach would be better for maintaining globals, and I'll create an issue to request alignment between them. I've synchronized with PR vitest-dev/eslint-plugin-vitest#599 and updated it. (dd5cdcb)

@sindresorhus sindresorhus merged commit 06a5723 into sindresorhus:main Dec 18, 2024
vaernion pushed a commit to Arbeidstilsynet/brevgen2 that referenced this pull request Dec 3, 2025
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [globals](https://github.com/sindresorhus/globals) | devDependencies | minor | [`15.13.0` -> `15.14.0`](https://renovatebot.com/diffs/npm/globals/15.13.0/15.14.0) |

---

### Release Notes

<details>
<summary>sindresorhus/globals (globals)</summary>

### [`v15.14.0`](https://github.com/sindresorhus/globals/releases/tag/v15.14.0)

[Compare Source](sindresorhus/globals@v15.13.0...v15.14.0)

-   Add `vitest` globals ([#&#8203;274](sindresorhus/globals#274))  [`06a5723`](sindresorhus/globals@06a5723)

</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 PR is renamed to start with "rebase!".

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

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Related work items: #30372
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants