Skip to content

Conversation

@connorshea
Copy link
Collaborator

Part of #14743.

  • typescript/no-namespace
  • react/exhaustive-deps
  • typescript/array-type
  • promise/always-return
  • eslint/curly

Generated docs:

## Configuration

This rule accepts a configuration object with the following properties:

### consistent

type: `boolean`

default: `false`

Whether to enforce consistent use of curly braces in if-else chains.


### curlyType

type: `"all" | "multi" | "multi-line" | "multi-or-nest"`

default: `"all"`

Which type of curly brace enforcement to use.

- `"all"`: require braces in all cases
- `"multi"`: require braces only for multi-statement blocks
- `"multi-line"`: require braces only for multi-line blocks
- `"multi-or-nest"`: require braces for multi-line blocks or when nested
## Configuration

This rule accepts a configuration object with the following properties:

### default

type: `"array" | "array-simple" | "generic"`

default: `"array"`

The array type expected for mutable cases.


### readonly

type: `"array" | "array-simple" | "generic"`

default: `null`

The array type expected for readonly cases. If omitted, the value for `default` will be used.
## Configuration

This rule accepts a configuration object with the following properties:

### ignoreAssignmentVariable

type: `string[]`

default: `["globalThis"]`

You can pass an `{ ignoreAssignmentVariable: [] }` as an option to this rule
with a list of variable names so that the last `then()` callback in a promise
chain does not warn if it does an assignment to a global variable. Default is
`["globalThis"]`.

\```javascript
/* eslint promise/always-return: ["error", { ignoreAssignmentVariable: ["globalThis"] }] */

// OK
promise.then((x) => {
globalThis = x
})

promise.then((x) => {
globalThis.x = x
})

// OK
promise.then((x) => {
globalThis.x.y = x
})

// NG
promise.then((x) => {
anyOtherVariable = x
})

// NG
promise.then((x) => {
anyOtherVariable.x = x
})

// NG
promise.then((x) => {
x()
})
\```


### ignoreLastCallback

type: `boolean`

default: `false`

You can pass an `{ ignoreLastCallback: true }` as an option to this rule so that
the last `then()` callback in a promise chain does not warn if it does not have
a `return`. Default is `false`.

\```javascript
// OK
promise.then((x) => {
console.log(x)
})
// OK
void promise.then((x) => {
console.log(x)
})
// OK
await promise.then((x) => {
console.log(x)
})

promise
// NG
.then((x) => {
console.log(x)
})
// OK
.then((x) => {
console.log(x)
})

// NG
const v = promise.then((x) => {
console.log(x)
})
// NG
const v = await promise.then((x) => {
console.log(x)
})
function foo() {
// NG
return promise.then((x) => {
console.log(x)
})
}
\```
## Configuration

This rule accepts a configuration object with the following properties:

### additionalHooks

type: `[
  string,
  null
]`

default: `null`

Optionally provide a regex of additional hooks to check.
## Configuration

This rule accepts a configuration object with the following properties:

### allowDeclarations

type: `boolean`

default: `false`

Whether to allow declare with custom TypeScript namespaces.

Examples of **incorrect** code for this rule when `{ "allowDeclarations": true }`
\```typescript
module foo {}
namespace foo {}
\```

Examples of **correct** code for this rule when `{ "allowDeclarations": true }`
\```typescript
declare module 'foo' {}
declare module foo {}
declare namespace foo {}

declare global {
namespace foo {}
}

declare module foo {
namespace foo {}
}
\```

Examples of **incorrect** code for this rule when `{ "allowDeclarations": false }`
\```typescript
module foo {}
namespace foo {}
declare module foo {}
declare namespace foo {}
\```

Examples of **correct** code for this rule when `{ "allowDeclarations": false }`
\```typescript
declare module 'foo' {}
\```


### allowDefinitionFiles

type: `boolean`

default: `true`

Examples of **incorrect** code for this rule when `{ "allowDefinitionFiles": true }`
\```typescript
// if outside a d.ts file
module foo {}
namespace foo {}

// if outside a d.ts file
module foo {}
namespace foo {}
declare module foo {}
declare namespace foo {}
\```

Examples of **correct** code for this rule when `{ "allowDefinitionFiles": true }`
\```typescript
declare module 'foo' {}
// anything inside a d.ts file
\```

Copilot AI review requested due to automatic review settings October 31, 2025 22:44
@connorshea connorshea requested a review from camc314 as a code owner October 31, 2025 22:44
@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 31, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added A-linter Area - Linter C-docs Category - Documentation. Related to user-facing or internal documentation labels Oct 31, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors configuration schema handling for lint rules by moving configuration documentation from the declare_oxc_lint! macro into field-level doc comments on config structs. This enables automatic schema generation using serde and schemars, making configurations more maintainable and self-documenting.

Key changes:

  • Added JsonSchema derive and serde attributes to config structs
  • Moved configuration option documentation from macro comments to struct field doc comments
  • Added config = ConfigType parameter to declare_oxc_lint! macro invocations
  • Removed trailing whitespace from test strings in curly.rs

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/oxc_linter/src/rules/typescript/no_namespace.rs Refactored NoNamespace config to use JsonSchema, moved option docs to struct fields
crates/oxc_linter/src/rules/typescript/array_type.rs Refactored ArrayType config to use JsonSchema with serde derives, moved option docs to struct fields
crates/oxc_linter/src/rules/react/exhaustive_deps.rs Refactored ExhaustiveDeps config to use JsonSchema, added field-level documentation
crates/oxc_linter/src/rules/promise/always_return.rs Refactored AlwaysReturn config to use JsonSchema, moved option docs to struct fields
crates/oxc_linter/src/rules/eslint/curly.rs Refactored Curly config to use JsonSchema with serde derives, removed trailing whitespace from test strings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 31, 2025

CodSpeed Performance Report

Merging #15199 will not alter performance

Comparing connorshea:docs-bundle-6 (2b891d3) with main (1b9f6fc)1

Summary

✅ 4 untouched
⏩ 33 skipped2

Footnotes

  1. No successful run was found on main (c45a080) during the generation of this report, so 1b9f6fc was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 33 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@camc314 camc314 merged commit 4ba1bca into oxc-project:main Nov 1, 2025
21 checks passed
@Boshen Boshen mentioned this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-docs Category - Documentation. Related to user-facing or internal documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants