> 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-this-before-super

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

| Preset                   | Configured Value |
| ------------------------ | ---------------- |
| ✅ js.configs.recommended | `"error"`        |


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

export default defineConfig([
  js.configs.recommended,
  {
    rules: {
      'no-this-before-super': 'error',
    },
  },
]);
```

## Rule Details

Disallows use of `this` or `super` (for property access like `super.foo`) before calling `super()` in constructors of derived classes.

In a derived class (a class that extends another class), the constructor must call `super()` before accessing `this` or `super` for property access. Accessing `this` or `super` before `super()` has been called will throw a `ReferenceError` at runtime.

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

```javascript
class A extends B {
  constructor() {
    this.a = 0; // "this" before "super()"
    super();
  }
}

class A extends B {
  constructor() {
    super.foo(); // "super" property access before "super()"
    super();
  }
}

class A extends B {
  constructor() {
    super(this.a); // "this" in super() arguments
  }
}
```

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

```javascript
class A extends B {
  constructor() {
    super();
    this.a = 0;
  }
}

class A {
  constructor() {
    this.a = 0; // OK - not a derived class
  }
}

class A extends B {
  constructor() {
    super();
    super.foo();
  }
}
```

## Original Documentation

- [ESLint: no-this-before-super](https://eslint.org/docs/latest/rules/no-this-before-super)
- [Source code](https://github.com/eslint/eslint/blob/v10.8.1/lib/rules/no-this-before-super.js)
