Skip to content

fix(linter): enforce config options for eslint/no-empty-function rule, improve docs.#19390

Merged
graphite-app[bot] merged 1 commit intomainfrom
no-empty-func-docs
Feb 14, 2026
Merged

fix(linter): enforce config options for eslint/no-empty-function rule, improve docs.#19390
graphite-app[bot] merged 1 commit intomainfrom
no-empty-func-docs

Conversation

@connorshea
Copy link
Member

@connorshea connorshea commented Feb 14, 2026

Part of #14743.

Changes in this PR:

  • Manually ported additional tests from the original rule (including some which fail and thus are commented-out, because of behavioral differences in Oxlint currently). Also added a few tests to ensure the kebab-case aliases work.
  • Refactored the code to use DefaultRuleConfig and proper auto-generated docs.
  • Updated the config option documentation to include examples for each option.

AI Disclosure: Built with help from Claude Code, Opus 4.6. Tested and reviewed by me.

Generated config documentation:

## Configuration

This rule accepts a configuration object with the following properties:

### allow

type: `array`

Types of functions that are allowed to be empty.

By default, no function kinds are allowed to be empty, but this option can be used to
permit specific kinds of functions.

Example:

```json
{
  "no-empty-function": ["error", { "allow": ["constructors"] }]
}
```

#### allow[n]

type: `"functions" | "arrowFunctions" | "generatorFunctions" | "methods" | "generatorMethods" | "getters" | "setters" | "constructors" | "asyncFunctions" | "asyncMethods" | "privateConstructors" | "protectedConstructors" | "decoratedFunctions" | "overrideMethods"`

Kinds of functions that can be allowed to be empty.

##### `"functions"`

Allow empty regular functions.

```js
function foo() {}
```

##### `"arrowFunctions"`

Allow empty arrow functions.

```js
const foo = () => {};
```

##### `"generatorFunctions"`

Allow empty generator functions.

```js
function* foo() {}
```

##### `"methods"`

Allow empty methods.

```js
class Foo {
  bar() {}
}
```

##### `"generatorMethods"`

Allow empty generator methods.

```js
class Foo {
  *bar() {}
}
```

##### `"getters"`

Allow empty getters.

```js
class Foo {
  get bar() {}
}
```

##### `"setters"`

Allow empty setters.

```js
class Foo {
  set bar(value) {}
}
```

##### `"constructors"`

Allow empty constructors.

```js
class Foo {
  constructor() {}
}
```

##### `"asyncFunctions"`

Allow empty async functions.

```js
async function foo() {}
```

##### `"asyncMethods"`

Allow empty async methods.

```js
class Foo {
  async bar() {}
}
```

##### `"privateConstructors"`

Allow empty private constructors.

```ts
class Foo {
  private constructor() {}
}
```

##### `"protectedConstructors"`

Allow empty protected constructors.

```ts
class Foo {
  protected constructor() {}
}
```

##### `"decoratedFunctions"`

Allow empty decorated functions.

```js
class Foo {
  @decorator()
  bar() {}
}
```

##### `"overrideMethods"`

Allow empty override methods.

```ts
class Foo extends Base {
  override bar() {}
}
```

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 pull request refactors the eslint/no-empty-function rule to use the DefaultRuleConfig pattern with auto-generated documentation instead of manual config parsing. The changes improve code maintainability and provide better schema documentation for the configuration options.

Changes:

  • Replaced manual JSON config parsing with DefaultRuleConfig and proper struct-based deserialization
  • Added AllowKind enum with serde aliases to support both camelCase and kebab-case variants from ESLint and TypeScript-ESLint
  • Updated documentation to use auto-generated format
  • Added comprehensive tests for kebab-case config aliases

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 14, 2026

Merging this PR will not alter performance

✅ 47 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing no-empty-func-docs (a1a54cc) with main (650ba9b)

Open in CodSpeed

Footnotes

  1. 3 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 changed the title fix(linter): Enforce config options for eslint/no-empty-function rule, improve docs. fix(linter): enforce config options for eslint/no-empty-function rule, improve docs. Feb 14, 2026
@camc314 camc314 self-assigned this Feb 14, 2026
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Feb 14, 2026
Copy link
Contributor

camc314 commented Feb 14, 2026

Merge activity

…le, improve docs. (#19390)

Part of #14743.

Changes in this PR:

- Manually ported additional tests from the original rule (including some which fail and thus are commented-out, because of behavioral differences in Oxlint currently). Also added a few tests to ensure the kebab-case aliases work.
- Refactored the code to use DefaultRuleConfig and proper auto-generated docs.
- Updated the config option documentation to include examples for each option.

AI Disclosure: Built with help from Claude Code, Opus 4.6. Tested and reviewed by me.

Generated config documentation:

````md

## Configuration

This rule accepts a configuration object with the following properties:

### allow

type: `array`

Types of functions that are allowed to be empty.

By default, no function kinds are allowed to be empty, but this option can be used to
permit specific kinds of functions.

Example:

```json
{
  "no-empty-function": ["error", { "allow": ["constructors"] }]
}
```

#### allow[n]

type: `"functions" | "arrowFunctions" | "generatorFunctions" | "methods" | "generatorMethods" | "getters" | "setters" | "constructors" | "asyncFunctions" | "asyncMethods" | "privateConstructors" | "protectedConstructors" | "decoratedFunctions" | "overrideMethods"`

Kinds of functions that can be allowed to be empty.

##### `"functions"`

Allow empty regular functions.

```js
function foo() {}
```

##### `"arrowFunctions"`

Allow empty arrow functions.

```js
const foo = () => {};
```

##### `"generatorFunctions"`

Allow empty generator functions.

```js
function* foo() {}
```

##### `"methods"`

Allow empty methods.

```js
class Foo {
  bar() {}
}
```

##### `"generatorMethods"`

Allow empty generator methods.

```js
class Foo {
  *bar() {}
}
```

##### `"getters"`

Allow empty getters.

```js
class Foo {
  get bar() {}
}
```

##### `"setters"`

Allow empty setters.

```js
class Foo {
  set bar(value) {}
}
```

##### `"constructors"`

Allow empty constructors.

```js
class Foo {
  constructor() {}
}
```

##### `"asyncFunctions"`

Allow empty async functions.

```js
async function foo() {}
```

##### `"asyncMethods"`

Allow empty async methods.

```js
class Foo {
  async bar() {}
}
```

##### `"privateConstructors"`

Allow empty private constructors.

```ts
class Foo {
  private constructor() {}
}
```

##### `"protectedConstructors"`

Allow empty protected constructors.

```ts
class Foo {
  protected constructor() {}
}
```

##### `"decoratedFunctions"`

Allow empty decorated functions.

```js
class Foo {
  @decorator()
  bar() {}
}
```

##### `"overrideMethods"`

Allow empty override methods.

```ts
class Foo extends Base {
  override bar() {}
}
```
````
@graphite-app graphite-app bot force-pushed the no-empty-func-docs branch from a1a54cc to bbced8d Compare February 14, 2026 21:58
@graphite-app graphite-app bot merged commit bbced8d into main Feb 14, 2026
21 checks passed
@graphite-app graphite-app bot deleted the no-empty-func-docs branch February 14, 2026 22:03
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Feb 14, 2026
camc314 pushed a commit that referenced this pull request Feb 16, 2026
# Oxlint
### 💥 BREAKING CHANGES

- 7711821 oxlint: [**BREAKING**] `no-shadow-restricted-names` report
`globalThis` by default (#19407) (Sysix)

### 🚀 Features

- ce1baa0 linter: Implement eslint/no-shadow (#18979) (Víctor Fernández)
- 7a333c1 linter: Support dynamic configs via CLI arguments (#19384)
(camc314)
- 1bf569b linter: Implement typescript/unified-signatures (#19375)
(camc314)
- 6562a9b linter: Implement typescript/parameter-properties (#19374)
(camc314)
- 94d8d74 linter: Implement typescript/no-use-before-define (#19373)
(camc314)
- 80b002a linter: Implement fixer for unicorn/no-instanceof-builtins
(#19371) (camc314)
- 5c3784b linter: Implement eslint/no-unmodified-loop-condition (#19341)
(Vincent R)
- cc00a59 linter/const-comparisons: Improve diagnostics when mixing
logical/comparison operators (#19370) (camc314)
- ea2c401 linter: Add support for no constructed context values (#18067)
(Jovi De Croock)
- f2440eb linter: Mark eslint/no-return-assign as having no fixer
(#19327) (camc314)
- 8588670 linter/unicorn: Implement suggestion for
`unicorn/no-await-in-promise-methods` rule (#19359) (Mikhail Baev)
- f0af965 linter: Move `jsx-a11y/no-static-element-interactions` rule
out of the nursery. (#19355) (connorshea)
- be0ce50 linter/tsgolint: Add support for labeled ranges in tsgolint
diagnostics (#19201) (camchenry)
- b5bc900 linter: Implement fixer for unicorn/no-new-buffer (#19326)
(camc314)
- 1612932 linter: Add typescript/no-unnecessary-condition (#19130)
(camc314)
- 37dc6c5 linter: Implement fixer for unicorn/prefer-includes (#19323)
(camc314)

### 🐛 Bug Fixes

- c2b1870 linter: Enforce config options for `react/forbid-dom-props`
rule. (#19387) (connorshea)
- 3d24e44 linter: Honor no-empty-function allow getters/setters for
object literals (#19393) (camc314)
- bbced8d linter: Enforce config options for `eslint/no-empty-function`
rule, improve docs. (#19390) (connorshea)
- 6bc8aec linter: Fix the behavior of `import/extensions` rule for a
file that has multiple extensions. (#18919) (connorshea)
- c62a295 linter/img-redundant-alt: Enforce whole-word matching for
redundant alt text (#19367) (camc314)
- 98956fe linter/describe-function-title: Skip autofix for type-only
imports (#19329) (camc314)
- d96d26d linter/plugins: Provide `parser.version` (#19364)
(overlookmotel)
- 81f0039 linter_codegen: Compute rule IDs relative to previous rule
(#19350) (camchenry)
- b7ef0a8 linter/consistent-indexed-object-style: Avoid unsafe Record
conversions for mapped types (#19320) (camc314)

### 📚 Documentation

- 3a6059f linter: Improve docs for `eslint/require-await` rule. (#19361)
(connorshea)
- b069269 linter/plugins: Add comment about deprecated `ScopeManager`
methods (#19363) (overlookmotel)
- 2d8aaf9 linter: Disable formatting for `eslint/no-unsafe-negation`
examples. (#19347) (connorshea)
- fb87806 linter: Ensure that we do not auto-format the docs for
`unicorn/number-literal-case` rule. (#19346) (connorshea)
- 8d3ae27 linter/typescript: Skip docs for deprecated type aware rule
options (#19324) (camc314)
# Oxfmt
### 💥 BREAKING CHANGES

- 00135b5 formatter/sort_imports: [**BREAKING**] Change default `groups`
order (#19427) (leaysgur)
- 9c34f72 formatter/sort_imports: [**BREAKING**] Report invalid group
name with renaming `side-effect` > `side_effect` (#19416) (leaysgur)

### 🚀 Features

- 4baebef formatter/sort_imports: Support `{ newlinesBetween: bool }`
inside `groups` (#19358) (leaysgur)
- d1c2fb6 formatter/sort_imports: Support `customGroups`
attributes(`selector` and `modifiers`) (#19356) (leaysgur)

### 🐛 Bug Fixes

- f084ea6 oxfmt: Explicitly pass `process.env` for the forked process
(#19380) (Long Ho)
- 2bc7a14 formatter: Arrow function body incorrectly broken when return
type has comment (#19368) (Dunqing)
- 90ec3d2 oxfmt: Update tailwind plugin which fixes crash on non-js file
(#19353) (leaysgur)
- e9c5b1e formatter: Treat `PrivateFieldExpression` as simple call
argument (#19348) (Dunqing)
- 80643d5 formatter: Match Prettier union indentation with leading
comments (#19271) (Dunqing)

### ⚡ Performance

- c169c77 syntax: Optimize `is_identifier_name_patched` (#19386)
(sapphi-red)
OskarLebuda pushed a commit to OskarLebuda/oxc that referenced this pull request Feb 17, 2026
…le, improve docs. (oxc-project#19390)

Part of oxc-project#14743.

Changes in this PR:

- Manually ported additional tests from the original rule (including some which fail and thus are commented-out, because of behavioral differences in Oxlint currently). Also added a few tests to ensure the kebab-case aliases work.
- Refactored the code to use DefaultRuleConfig and proper auto-generated docs.
- Updated the config option documentation to include examples for each option.

AI Disclosure: Built with help from Claude Code, Opus 4.6. Tested and reviewed by me.

Generated config documentation:

````md

## Configuration

This rule accepts a configuration object with the following properties:

### allow

type: `array`

Types of functions that are allowed to be empty.

By default, no function kinds are allowed to be empty, but this option can be used to
permit specific kinds of functions.

Example:

```json
{
  "no-empty-function": ["error", { "allow": ["constructors"] }]
}
```

#### allow[n]

type: `"functions" | "arrowFunctions" | "generatorFunctions" | "methods" | "generatorMethods" | "getters" | "setters" | "constructors" | "asyncFunctions" | "asyncMethods" | "privateConstructors" | "protectedConstructors" | "decoratedFunctions" | "overrideMethods"`

Kinds of functions that can be allowed to be empty.

##### `"functions"`

Allow empty regular functions.

```js
function foo() {}
```

##### `"arrowFunctions"`

Allow empty arrow functions.

```js
const foo = () => {};
```

##### `"generatorFunctions"`

Allow empty generator functions.

```js
function* foo() {}
```

##### `"methods"`

Allow empty methods.

```js
class Foo {
  bar() {}
}
```

##### `"generatorMethods"`

Allow empty generator methods.

```js
class Foo {
  *bar() {}
}
```

##### `"getters"`

Allow empty getters.

```js
class Foo {
  get bar() {}
}
```

##### `"setters"`

Allow empty setters.

```js
class Foo {
  set bar(value) {}
}
```

##### `"constructors"`

Allow empty constructors.

```js
class Foo {
  constructor() {}
}
```

##### `"asyncFunctions"`

Allow empty async functions.

```js
async function foo() {}
```

##### `"asyncMethods"`

Allow empty async methods.

```js
class Foo {
  async bar() {}
}
```

##### `"privateConstructors"`

Allow empty private constructors.

```ts
class Foo {
  private constructor() {}
}
```

##### `"protectedConstructors"`

Allow empty protected constructors.

```ts
class Foo {
  protected constructor() {}
}
```

##### `"decoratedFunctions"`

Allow empty decorated functions.

```js
class Foo {
  @decorator()
  bar() {}
}
```

##### `"overrideMethods"`

Allow empty override methods.

```ts
class Foo extends Base {
  override bar() {}
}
```
````
OskarLebuda pushed a commit to OskarLebuda/oxc that referenced this pull request Feb 17, 2026
# Oxlint
### 💥 BREAKING CHANGES

- 7711821 oxlint: [**BREAKING**] `no-shadow-restricted-names` report
`globalThis` by default (oxc-project#19407) (Sysix)

### 🚀 Features

- ce1baa0 linter: Implement eslint/no-shadow (oxc-project#18979) (Víctor Fernández)
- 7a333c1 linter: Support dynamic configs via CLI arguments (oxc-project#19384)
(camc314)
- 1bf569b linter: Implement typescript/unified-signatures (oxc-project#19375)
(camc314)
- 6562a9b linter: Implement typescript/parameter-properties (oxc-project#19374)
(camc314)
- 94d8d74 linter: Implement typescript/no-use-before-define (oxc-project#19373)
(camc314)
- 80b002a linter: Implement fixer for unicorn/no-instanceof-builtins
(oxc-project#19371) (camc314)
- 5c3784b linter: Implement eslint/no-unmodified-loop-condition (oxc-project#19341)
(Vincent R)
- cc00a59 linter/const-comparisons: Improve diagnostics when mixing
logical/comparison operators (oxc-project#19370) (camc314)
- ea2c401 linter: Add support for no constructed context values (oxc-project#18067)
(Jovi De Croock)
- f2440eb linter: Mark eslint/no-return-assign as having no fixer
(oxc-project#19327) (camc314)
- 8588670 linter/unicorn: Implement suggestion for
`unicorn/no-await-in-promise-methods` rule (oxc-project#19359) (Mikhail Baev)
- f0af965 linter: Move `jsx-a11y/no-static-element-interactions` rule
out of the nursery. (oxc-project#19355) (connorshea)
- be0ce50 linter/tsgolint: Add support for labeled ranges in tsgolint
diagnostics (oxc-project#19201) (camchenry)
- b5bc900 linter: Implement fixer for unicorn/no-new-buffer (oxc-project#19326)
(camc314)
- 1612932 linter: Add typescript/no-unnecessary-condition (oxc-project#19130)
(camc314)
- 37dc6c5 linter: Implement fixer for unicorn/prefer-includes (oxc-project#19323)
(camc314)

### 🐛 Bug Fixes

- c2b1870 linter: Enforce config options for `react/forbid-dom-props`
rule. (oxc-project#19387) (connorshea)
- 3d24e44 linter: Honor no-empty-function allow getters/setters for
object literals (oxc-project#19393) (camc314)
- bbced8d linter: Enforce config options for `eslint/no-empty-function`
rule, improve docs. (oxc-project#19390) (connorshea)
- 6bc8aec linter: Fix the behavior of `import/extensions` rule for a
file that has multiple extensions. (oxc-project#18919) (connorshea)
- c62a295 linter/img-redundant-alt: Enforce whole-word matching for
redundant alt text (oxc-project#19367) (camc314)
- 98956fe linter/describe-function-title: Skip autofix for type-only
imports (oxc-project#19329) (camc314)
- d96d26d linter/plugins: Provide `parser.version` (oxc-project#19364)
(overlookmotel)
- 81f0039 linter_codegen: Compute rule IDs relative to previous rule
(oxc-project#19350) (camchenry)
- b7ef0a8 linter/consistent-indexed-object-style: Avoid unsafe Record
conversions for mapped types (oxc-project#19320) (camc314)

### 📚 Documentation

- 3a6059f linter: Improve docs for `eslint/require-await` rule. (oxc-project#19361)
(connorshea)
- b069269 linter/plugins: Add comment about deprecated `ScopeManager`
methods (oxc-project#19363) (overlookmotel)
- 2d8aaf9 linter: Disable formatting for `eslint/no-unsafe-negation`
examples. (oxc-project#19347) (connorshea)
- fb87806 linter: Ensure that we do not auto-format the docs for
`unicorn/number-literal-case` rule. (oxc-project#19346) (connorshea)
- 8d3ae27 linter/typescript: Skip docs for deprecated type aware rule
options (oxc-project#19324) (camc314)
# Oxfmt
### 💥 BREAKING CHANGES

- 00135b5 formatter/sort_imports: [**BREAKING**] Change default `groups`
order (oxc-project#19427) (leaysgur)
- 9c34f72 formatter/sort_imports: [**BREAKING**] Report invalid group
name with renaming `side-effect` > `side_effect` (oxc-project#19416) (leaysgur)

### 🚀 Features

- 4baebef formatter/sort_imports: Support `{ newlinesBetween: bool }`
inside `groups` (oxc-project#19358) (leaysgur)
- d1c2fb6 formatter/sort_imports: Support `customGroups`
attributes(`selector` and `modifiers`) (oxc-project#19356) (leaysgur)

### 🐛 Bug Fixes

- f084ea6 oxfmt: Explicitly pass `process.env` for the forked process
(oxc-project#19380) (Long Ho)
- 2bc7a14 formatter: Arrow function body incorrectly broken when return
type has comment (oxc-project#19368) (Dunqing)
- 90ec3d2 oxfmt: Update tailwind plugin which fixes crash on non-js file
(oxc-project#19353) (leaysgur)
- e9c5b1e formatter: Treat `PrivateFieldExpression` as simple call
argument (oxc-project#19348) (Dunqing)
- 80643d5 formatter: Match Prettier union indentation with leading
comments (oxc-project#19271) (Dunqing)

### ⚡ Performance

- c169c77 syntax: Optimize `is_identifier_name_patched` (oxc-project#19386)
(sapphi-red)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments