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, and this page is available as Markdown at https://rslint.rs/rules/eslint/no-delete-var.md.
close

no-delete-var

Added in v0.4.2

Configuration

PresetConfigured Value
✅ js.configs.recommended"error"
rslint.config.ts
import { defineConfig, js } from '@rslint/core';

export default defineConfig([
  js.configs.recommended,
  {
    rules: {
      'no-delete-var': 'error',
    },
  },
]);

Rule Details

Disallows the use of the delete operator on variables.

The purpose of the delete operator is to remove a property from an object. Using the delete operator on a variable might lead to unexpected behavior.

Examples of incorrect code for this rule:

var x;
delete x;

Examples of correct code for this rule:

var obj = { x: 1 };
delete obj.x;

Original Documentation