Skip to content

Conversation

@connorshea
Copy link
Contributor

Part of #14743.

  • eslint/grouped-accessor-pairs
  • eslint/class-methods-use-this
  • typescript/no-require-imports
  • eslint/max-lines

Generated docs:

## Configuration

This rule accepts a configuration object with the following properties:

### max

type: `integer`

default: `300`

Maximum number of lines allowed per file.


### skipBlankLines

type: `boolean`

default: `false`

Whether to ignore blank lines when counting.


### skipComments

type: `boolean`

default: `false`

Whether to ignore comments when counting.
## Configuration

This rule accepts a configuration object with the following properties:

### allow

type: `string[]`

default: `[]`

These strings will be compiled into regular expressions with the u flag and be used to test against the imported path.
A common use case is to allow importing `package.json`. This is because `package.json` commonly lives outside of the TS root directory,
so statically importing it would lead to root directory conflicts, especially with `resolveJsonModule` enabled.
You can also use it to allow importing any JSON if your environment doesn't support JSON modules, or use it for other cases where `import` statements cannot work.

With `{ allow: ['/package\\.json$'] }`:

Examples of **correct** code for this rule:
\```ts
console.log(require('../package.json').version);
\```


### allowAsImport

type: `boolean`

default: `false`

When set to `true`, `import ... = require(...)` declarations won't be reported.
This is useful if you use certain module options that require strict CommonJS interop semantics.

When set to `true`:

Examples of **incorrect** code for this rule:
\```ts
var foo = require('foo');
const foo = require('foo');
let foo = require('foo');
\```
Examples of **correct** code for this rule:
\```ts
import foo = require('foo');
import foo from 'foo';
\```
## Configuration

This rule accepts a configuration object with the following properties:

### enforceForClassFields

type: `boolean`

default: `true`

Enforce this rule for class fields that are functions.


### exceptMethods

type: `array`

default: `[]`

List of method names to exempt from this rule.


#### exceptMethods[n]

type: `object`





##### exceptMethods[n].name

type: `string`





##### exceptMethods[n].private

type: `boolean`





### ignoreClassesWithImplements

type: `"all" | "public-fields"`

default: `null`

Whether to ignore classes that implement interfaces.


### ignoreOverrideMethods

type: `boolean`

default: `false`

Whether to ignore methods that are overridden.
## Configuration

This rule accepts a configuration object with the following properties:

### enforceForTSTypes

type: `boolean`

default: `false`

When `enforceForTSTypes` is enabled, this rule also applies to TypeScript interfaces and type aliases:

Examples of **incorrect** TypeScript code:
\```ts
interface Foo {
get a(): string;
someProperty: string;
set a(value: string);
}

type Bar = {
get b(): string;
someProperty: string;
set b(value: string);
};
\```

Examples of **correct** TypeScript code:
\```ts
interface Foo {
get a(): string;
set a(value: string);
someProperty: string;
}

type Bar = {
get b(): string;
set b(value: string);
someProperty: string;
};
\```


### pairOrder

type: `"anyOrder" | "getBeforeSet" | "setBeforeGet"`

default: `"anyOrder"`

A string value to control the order of the getter/setter pairs:
- `"anyOrder"`: Accessors can be in any order
- `"getBeforeSet"`: Getters must come before setters
- `"setBeforeGet"`: Setters must come before getters

Copilot AI review requested due to automatic review settings October 31, 2025 21:02
@connorshea connorshea requested a review from camc314 as a code owner October 31, 2025 21:02
@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 adds JSON schema configuration support to four linter rules by adding JsonSchema derives and moving option documentation from the rule description to struct field documentation.

  • Added JsonSchema derive and serde attributes to configuration structs
  • Moved configuration documentation from declare_oxc_lint! macro to struct field doc comments
  • Added config parameter to declare_oxc_lint! macro calls

Reviewed Changes

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

File Description
crates/oxc_linter/src/rules/typescript/no_require_imports.rs Added JsonSchema support and moved allow and allow_as_import option docs to struct fields
crates/oxc_linter/src/rules/eslint/max_lines.rs Added JsonSchema support and field documentation for max, skip_blank_lines, and skip_comments
crates/oxc_linter/src/rules/eslint/grouped_accessor_pairs.rs Added JsonSchema, Serialize, and Deserialize derives with field documentation for accessor pair ordering
crates/oxc_linter/src/rules/eslint/class_methods_use_this.rs Added JsonSchema, Serialize, and Deserialize derives with field documentation for class method configuration

💡 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 #15197 will not alter performance

Comparing connorshea:doc-batch-3 (fff999f) with main (1b9f6fc)1

Summary

✅ 4 untouched
⏩ 33 skipped2

Footnotes

  1. No successful run was found on main (baaeca8) 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 e6677b1 into oxc-project:main Nov 1, 2025
27 checks passed
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