> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# no-confusing-void-expression

[Added in v0.1.4](https://github.com/web-infra-dev/rslint/releases/tag/v0.1.4)
## Configuration

| Preset                         | Configured Value |
| ------------------------------ | ---------------- |
| ✅ ts.configs.strictTypeChecked | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
  ts.configs.recommended,
  {
    rules: {
      '@typescript-eslint/no-confusing-void-expression': 'error',
    },
  },
]);
```

## Rule Details

Disallows void type expressions from being used in misleading locations such as being assigned to a variable, returned from a function, or used inside other expressions. The `void` type in TypeScript indicates a function returns nothing, and using void-returning expressions in value positions can lead to confusing code.

Examples of **incorrect** code for this rule:

```typescript
// Assigning a void expression to a variable
const result = console.log('hello');

// Returning a void expression from a function
function foo() {
  return console.log('hello');
}

// Using a void expression in an arrow function shorthand
const fn = () => console.log('hello');
```

Examples of **correct** code for this rule:

```typescript
// Void expression as a standalone statement
console.log('hello');

// Arrow function with braces
const fn = () => {
  console.log('hello');
};

// Explicit void operator (with ignoreVoidOperator option)
const fn = () => void console.log('hello');
```

## Original Documentation

- [typescript-eslint: no-confusing-void-expression](https://typescript-eslint.io/rules/no-confusing-void-expression)
- [Source code](https://github.com/typescript-eslint/typescript-eslint/blob/v8.67.0/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts)
