> 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.

# parameter-properties

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


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

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

## Rule Details

Require or disallow parameter properties in class constructors.

TypeScript includes a shorthand for declaring and initializing class members from constructor parameters called parameter properties. This rule can be used to enforce consistent usage of this feature.

## Options

- `prefer` (`"class-property"` | `"parameter-property"`): Whether to prefer class properties or parameter properties. Default: `"class-property"`.
- `allow` (array of modifiers): Which parameter property modifiers to allow. Valid values: `"readonly"`, `"private"`, `"protected"`, `"public"`, `"private readonly"`, `"protected readonly"`, `"public readonly"`. Default: `[]`.

### `prefer: "class-property"` (default)

Examples of **incorrect** code:

```typescript
class Foo {
  constructor(readonly name: string) {}
}

class Bar {
  constructor(private age: number) {}
}
```

Examples of **correct** code:

```typescript
class Foo {
  constructor(name: string) {}
}
```

### `prefer: "parameter-property"`

Examples of **incorrect** code:

```typescript
class Foo {
  member: string;
  constructor(member: string) {
    this.member = member;
  }
}
```

Examples of **correct** code:

```typescript
class Foo {
  constructor(private member: string) {}
}
```

## Original Documentation

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