Skip to content

docs: document userland patterns for global assertionOptions in RuleT…#20986

Merged
DMartens merged 3 commits into
eslint:mainfrom
loveme-3000:docs/global-assertion-options-userland
Jun 20, 2026
Merged

docs: document userland patterns for global assertionOptions in RuleT…#20986
DMartens merged 3 commits into
eslint:mainfrom
loveme-3000:docs/global-assertion-options-userland

Conversation

@loveme-3000

@loveme-3000 loveme-3000 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Prerequisites checklist

AI acknowledgment

  • I did not use AI to generate this PR.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

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

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

Fixes #20613

What changes did you make? (Give an overview)

Added a new section "Enforcing assertionOptions Globally" to the RuleTester documentation in docs/src/integrate/nodejs-api.md.

Because assertionOptions is specified per run() call, there is currently no built-in way to enforce the same options across every call in a project. As discussed in #20613, the team decided to document userland patterns instead of adding a new API.

This PR documents two common approaches:

  1. Subclassing RuleTester — Override run() to inject default assertionOptions, allowing per-call overrides via object spread.
  2. Helper wrapper function — A standalone function that wraps ruleTester.run() with default assertionOptions, also supporting per-call overrides.

Both approaches were mentioned by @mdjermanovic in the issue discussion. The section is placed directly after the existing assertionOptions property documentation, under RuleTester#run().

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

  • Whether documenting both approaches (subclass + helper function) is preferred, or if the team would like only one. @DMartens mentioned documenting "one way to do it," but @mdjermanovic referenced both patterns, so I included both for completeness.

@loveme-3000 loveme-3000 requested a review from a team as a code owner June 15, 2026 10:03
@github-project-automation github-project-automation Bot moved this to Needs Triage in Triage Jun 15, 2026
@netlify

netlify Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploy Preview for docs-eslint ready!

Name Link
🔨 Latest commit 37a5027
🔍 Latest deploy log https://app.netlify.com/projects/docs-eslint/deploys/6a35472ce8423400082d7f04
😎 Deploy Preview https://deploy-preview-20986--docs-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 15, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: loveme-3000 / name: loveme-3000 (19104b0)

@eslint-github-bot eslint-github-bot Bot added the documentation Relates to ESLint's documentation label Jun 15, 2026
Comment thread docs/src/integrate/nodejs-api.md Outdated
- If `"error"`, each error object that specifies `messageId` must also specify `data` if the message referenced by `messageId` has [placeholders](../extend/custom-rules#use-message-placeholders).
- If `"suggestion"`, each suggestion object that specifies `messageId` must also specify `data` if the message referenced by `messageId` has [placeholders](../extend/custom-rules#use-message-placeholders).

#### Enforcing `assertionOptions` Globally

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this should be a subsection under the existing "Customizing RuleTester".

Comment thread docs/src/integrate/nodejs-api.md Outdated
}
```

Both approaches use object spread so that any `assertionOptions` provided on a specific `run()` call are merged on top of the defaults, allowing per-test-file overrides where needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This text is already present twice before in the examples, I do not think this should be repeated again.

Comment thread docs/src/integrate/nodejs-api.md Outdated
```js
const { RuleTester } = require("eslint");

class StrictRuleTester extends RuleTester {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For both examples, it would make more sense to export the class or function.

@DMartens

Copy link
Copy Markdown
Contributor

Please review our AI usage policy as the AI usage is not disclosed but this seems to be AI-generated (wording such as "userland" and repeating the same information multiple times).

@lumirlumir lumirlumir moved this from Needs Triage to Triaging in Triage Jun 15, 2026
- Move 'Enforcing assertionOptions Globally' under 'Customizing RuleTester'

- Remove redundant object spread explanation paragraph

- Export class/function in both examples
@loveme-3000 loveme-3000 requested a review from DMartens June 18, 2026 17:19
Comment thread docs/src/integrate/nodejs-api.md

@DMartens DMartens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes LGTM, thanks.

@DMartens DMartens merged commit f5449f9 into eslint:main Jun 20, 2026
36 checks passed
@github-project-automation github-project-automation Bot moved this from Triaging to Complete in Triage Jun 20, 2026
bjw-s added a commit to bjw-s-labs/action-changed-files that referenced this pull request Jun 28, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [@rollup/rollup-linux-x64-gnu](https://rollupjs.org/) ([source](https://github.com/rollup/rollup)) | [`4.62.0` → `4.62.2`](https://renovatebot.com/diffs/npm/@rollup%2frollup-linux-x64-gnu/4.62.0/4.62.2) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@rollup%2frollup-linux-x64-gnu/4.62.2?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@rollup%2frollup-linux-x64-gnu/4.62.0/4.62.2?slim=true) |
| [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin)) | [`8.61.1` → `8.62.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.61.1/8.62.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@typescript-eslint%2feslint-plugin/8.62.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@typescript-eslint%2feslint-plugin/8.61.1/8.62.0?slim=true) |
| [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser)) | [`8.61.1` → `8.62.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.61.1/8.62.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@typescript-eslint%2fparser/8.62.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@typescript-eslint%2fparser/8.61.1/8.62.0?slim=true) |
| [eslint](https://eslint.org) ([source](https://github.com/eslint/eslint)) | [`10.5.0` → `10.6.0`](https://renovatebot.com/diffs/npm/eslint/10.5.0/10.6.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/eslint/10.6.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/eslint/10.5.0/10.6.0?slim=true) |
| [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) | [`29.15.2` → `29.15.3`](https://renovatebot.com/diffs/npm/eslint-plugin-jest/29.15.2/29.15.3) | ![age](https://developer.mend.io/api/mc/badges/age/npm/eslint-plugin-jest/29.15.3?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/eslint-plugin-jest/29.15.2/29.15.3?slim=true) |
| [globals](https://github.com/sindresorhus/globals) | [`17.6.0` → `17.7.0`](https://renovatebot.com/diffs/npm/globals/17.6.0/17.7.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/globals/17.7.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/globals/17.6.0/17.7.0?slim=true) |
| [prettier](https://prettier.io) ([source](https://github.com/prettier/prettier)) | [`3.8.4` → `3.9.1`](https://renovatebot.com/diffs/npm/prettier/3.8.4/3.9.1) | ![age](https://developer.mend.io/api/mc/badges/age/npm/prettier/3.9.1?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/prettier/3.8.4/3.9.1?slim=true) |
| [rollup](https://rollupjs.org/) ([source](https://github.com/rollup/rollup)) | [`4.62.0` → `4.62.2`](https://renovatebot.com/diffs/npm/rollup/4.62.0/4.62.2) | ![age](https://developer.mend.io/api/mc/badges/age/npm/rollup/4.62.2?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/rollup/4.62.0/4.62.2?slim=true) |

---

### Release Notes

<details>
<summary>rollup/rollup (@&#8203;rollup/rollup-linux-x64-gnu)</summary>

### [`v4.62.2`](https://github.com/rollup/rollup/blob/HEAD/CHANGELOG.md#4622)

[Compare Source](rollup/rollup@v4.62.1...v4.62.2)

*2026-06-19*

##### Bug Fixes

- Do not add spurious side-effect-free external imports to chunks when using minChunkSize ([#&#8203;6411](rollup/rollup#6411))

##### Pull Requests

- [#&#8203;6411](rollup/rollup#6411): Skip side-effect-free external imports when hoisting is disabled ([@&#8203;morgan-coded](https://github.com/morgan-coded), [@&#8203;lukastaegert](https://github.com/lukastaegert))
- [#&#8203;6416](rollup/rollup#6416): refactor(rust/parser\_ast): extract property AstConverter write buffer kind logic to new method ([@&#8203;fabianbernhart](https://github.com/fabianbernhart), [@&#8203;lukastaegert](https://github.com/lukastaegert))

### [`v4.62.1`](https://github.com/rollup/rollup/blob/HEAD/CHANGELOG.md#4621)

[Compare Source](rollup/rollup@v4.62.0...v4.62.1)

*2026-06-19*

##### Bug Fixes

- Preserve multipart file extensions when deconflicting output chunks ([#&#8203;6408](rollup/rollup#6408))
- Fix an issue where getLogFilter would match additional logs ([#&#8203;6415](rollup/rollup#6415))

##### Pull Requests

- [#&#8203;6393](rollup/rollup#6393): Use import attributes for importing JSON ([@&#8203;selfisekai](https://github.com/selfisekai), [@&#8203;lukastaegert](https://github.com/lukastaegert))
- [#&#8203;6408](rollup/rollup#6408): fix: insert conflict numbers before first extension in multi-extension filenames ([@&#8203;LeSingh1](https://github.com/LeSingh1), [@&#8203;lukastaegert](https://github.com/lukastaegert))
- [#&#8203;6415](rollup/rollup#6415): fix: advance value past wildcard prefix before suffix check in getLogFilter ([@&#8203;JSap0914](https://github.com/JSap0914), [@&#8203;lukastaegert](https://github.com/lukastaegert))
- [#&#8203;6417](rollup/rollup#6417): chore(deps): update msys2/setup-msys2 digest to [`66cd2cc`](rollup/rollup@66cd2cc) ([@&#8203;renovate](https://github.com/renovate)\[bot])
- [#&#8203;6418](rollup/rollup#6418): fix(deps): update minor/patch updates ([@&#8203;renovate](https://github.com/renovate)\[bot], [@&#8203;lukastaegert](https://github.com/lukastaegert))
- [#&#8203;6419](rollup/rollup#6419): chore(deps): update dependency eslint-plugin-unicorn to v66 ([@&#8203;renovate](https://github.com/renovate)\[bot])
- [#&#8203;6420](rollup/rollup#6420): chore(deps): lock file maintenance minor/patch updates ([@&#8203;renovate](https://github.com/renovate)\[bot], [@&#8203;lukastaegert](https://github.com/lukastaegert))

</details>

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>

### [`v8.62.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8620-2026-06-22)

[Compare Source](typescript-eslint/typescript-eslint@v8.61.1...v8.62.0)

##### 🚀 Features

- remove redundant package.json "files" ([#&#8203;12444](typescript-eslint/typescript-eslint#12444))

##### ❤️ Thank You

- Kirk Waiblinger [@&#8203;kirkwaiblinger](https://github.com/kirkwaiblinger)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.62.0) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.

</details>

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>

### [`v8.62.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8620-2026-06-22)

[Compare Source](typescript-eslint/typescript-eslint@v8.61.1...v8.62.0)

##### 🚀 Features

- remove redundant package.json "files" ([#&#8203;12444](typescript-eslint/typescript-eslint#12444))

##### ❤️ Thank You

- Kirk Waiblinger [@&#8203;kirkwaiblinger](https://github.com/kirkwaiblinger)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.62.0) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.

</details>

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

### [`v10.6.0`](https://github.com/eslint/eslint/releases/tag/v10.6.0)

[Compare Source](eslint/eslint@v10.5.0...v10.6.0)

#### Features

- [`b1f9106`](eslint/eslint@b1f9106) feat: detect Symbol() and BigInt() in no-constant-binary-expression ([#&#8203;20981](eslint/eslint#20981)) (Taejin Kim)
- [`f291007`](eslint/eslint@f291007) feat: add checkRelationalComparisons to no-constant-binary-expression ([#&#8203;20948](eslint/eslint#20948)) (sethamus)

#### Bug Fixes

- [`6b05784`](eslint/eslint@6b05784) fix: prefer-exponentiation-operator invalid autofix at statement start ([#&#8203;20997](eslint/eslint#20997)) (Milos Djermanovic)
- [`bb9eb2a`](eslint/eslint@bb9eb2a) fix: account for shadowed `Boolean` in `no-extra-boolean-cast` ([#&#8203;21013](eslint/eslint#21013)) (den$)
- [`8fd8741`](eslint/eslint@8fd8741) fix: don't report shadowed undefined in `radix` rule ([#&#8203;21011](eslint/eslint#21011)) (Pixel)
- [`5784980`](eslint/eslint@5784980) fix: don't report shadowed undefined in no-throw-literal ([#&#8203;21010](eslint/eslint#21010)) (Pixel)
- [`9cd1e6d`](eslint/eslint@9cd1e6d) fix: suppress invalid class suggestion in no-promise-executor-return ([#&#8203;21008](eslint/eslint#21008)) (Pixel)
- [`d4eb2dc`](eslint/eslint@d4eb2dc) fix: don't report shadowed undefined in prefer-promise-reject-errors ([#&#8203;21006](eslint/eslint#21006)) (Pixel)
- [`2360464`](eslint/eslint@2360464) fix: prefer-promise-reject-errors false positives for shadowed Promise ([#&#8203;21003](eslint/eslint#21003)) (den$)
- [`63d52d2`](eslint/eslint@63d52d2) fix: restore max-classes-per-file report range ([#&#8203;21002](eslint/eslint#21002)) (Pixel)
- [`7feaff0`](eslint/eslint@7feaff0) fix: callback detection logic for IIFEs in max-nested-callbacks ([#&#8203;20979](eslint/eslint#20979)) (fnx)
- [`399a2ec`](eslint/eslint@399a2ec) fix: don't report inner non-callbacks in `max-nested-callbacks` ([#&#8203;20995](eslint/eslint#20995)) (Milos Djermanovic)

#### Documentation

- [`a83683d`](eslint/eslint@a83683d) docs: Update README (GitHub Actions Bot)
- [`f5449f9`](eslint/eslint@f5449f9) docs: document userland patterns for global assertionOptions in RuleT… ([#&#8203;20986](eslint/eslint#20986)) (playgirl)
- [`bea49f7`](eslint/eslint@bea49f7) docs: Update README (GitHub Actions Bot)
- [`e5f70f9`](eslint/eslint@e5f70f9) docs: update code-path diagrams ([#&#8203;20984](eslint/eslint#20984)) (Tanuj Kanti)
- [`8890c2d`](eslint/eslint@8890c2d) docs: add TypeScript config guidance for MCP server ([#&#8203;20796](eslint/eslint#20796)) (Pierluigi Lenoci)
- [`3eb3d9b`](eslint/eslint@3eb3d9b) docs: Update README (GitHub Actions Bot)
- [`c5bb59c`](eslint/eslint@c5bb59c) docs: Update README (GitHub Actions Bot)
- [`eb3c97c`](eslint/eslint@eb3c97c) docs: fix grammar in prefer-const rule description ([#&#8203;20983](eslint/eslint#20983)) (lumir)

#### Chores

- [`6a42034`](eslint/eslint@6a42034) ci: run ecosystem tests on main branch ([#&#8203;20891](eslint/eslint#20891)) (sethamus)
- [`3dbacdb`](eslint/eslint@3dbacdb) ci: bump actions/checkout from 6 to 7 ([#&#8203;21014](eslint/eslint#21014)) (dependabot\[bot])
- [`c3abfca`](eslint/eslint@c3abfca) chore: correct JSDoc param types in html formatter ([#&#8203;21018](eslint/eslint#21018)) (Minseon Kim)
- [`a832320`](eslint/eslint@a832320) ci: split ecosystem tests into separate jobs ([#&#8203;21001](eslint/eslint#21001)) (xbinaryx)
- [`27166e7`](eslint/eslint@27166e7) chore: update ecosystem plugins ([#&#8203;21005](eslint/eslint#21005)) (ESLint Bot)
- [`865d76e`](eslint/eslint@865d76e) ci: bump pnpm/action-setup from 6.0.8 to 6.0.9 ([#&#8203;20989](eslint/eslint#20989)) (dependabot\[bot])
- [`27a88c9`](eslint/eslint@27a88c9) chore: update dependency markdown-it to v14 in root ([#&#8203;20994](eslint/eslint#20994)) (Milos Djermanovic)
- [`970cea6`](eslint/eslint@970cea6) chore: update dependency markdown-it to v14 ([#&#8203;20993](eslint/eslint#20993)) (Milos Djermanovic)
- [`b482120`](eslint/eslint@b482120) chore: update dependency prettier to v3.8.4 ([#&#8203;20990](eslint/eslint#20990)) (renovate\[bot])
- [`6993fb3`](eslint/eslint@6993fb3) chore: update ecosystem plugins ([#&#8203;20985](eslint/eslint#20985)) (ESLint Bot)

</details>

<details>
<summary>jest-community/eslint-plugin-jest (eslint-plugin-jest)</summary>

### [`v29.15.3`](https://github.com/jest-community/eslint-plugin-jest/blob/HEAD/CHANGELOG.md#29153-2026-06-26)

[Compare Source](jest-community/eslint-plugin-jest@v29.15.2...v29.15.3)

##### Bug Fixes

- **no-export:** treat describe blocks as test files ([#&#8203;1978](jest-community/eslint-plugin-jest#1978)) ([70568b0](jest-community/eslint-plugin-jest@70568b0))

</details>

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

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

[Compare Source](sindresorhus/globals@v17.6.0...v17.7.0)

- Update globals (2026-06-22) ([#&#8203;345](sindresorhus/globals#345))  [`33b75f9`](sindresorhus/globals@33b75f9)

***

</details>

<details>
<summary>prettier/prettier (prettier)</summary>

### [`v3.9.1`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#391)

[Compare Source](prettier/prettier@3.9.0...3.9.1)

[diff](prettier/prettier@3.9.0...3.9.1)

##### CLI: Fix ignored file has been cached incorrectly ([#&#8203;19483](prettier/prettier#19483) by [@&#8203;kovsu](https://github.com/kovsu))

Bug details [#&#8203;18016](prettier/prettier#18016)

### [`v3.9.0`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#390)

[Compare Source](prettier/prettier@3.8.5...3.9.0)

[diff](prettier/prettier@3.8.5...3.9.0)

🔗 [Release Notes](https://prettier.io/blog/2026/06/27/3.9.0)

### [`v3.8.5`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#385)

[Compare Source](prettier/prettier@3.8.4...3.8.5)

[diff](prettier/prettier@3.8.4...3.8.5)

##### Flow: Support `readonly` as a variance annotation ([#&#8203;19022](prettier/prettier#19022) by [@&#8203;marcoww6](https://github.com/marcoww6))

Flow now accepts `readonly` as a property variance annotation, equivalent to `+` (covariant/read-only).

<!-- prettier-ignore -->

```jsx
// Input
type T = {
  readonly foo: string,
};

// Prettier 3.8.4
SyntaxError

// Prettier 3.8.5
type T = {
  readonly foo: string,
};
```

</details>

---

### Configuration

📅 **Schedule**: (in timezone Europe/Amsterdam)

- Branch creation
  - "before 6am on monday"
- 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.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](undefined) if that's undesired.

---

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

---

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

Co-authored-by: Bernd Schorgers <me@bjw-s.dev>
Co-authored-by: lab-assistant <lab-assistant@git.bjw-s.dev>
Reviewed-on: https://git.bjw-s.dev/bjw-s/action-changed-files/pulls/56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Relates to ESLint's documentation

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

Change Request: Add the option to define assertionOptions globally

3 participants