close

no-empty-pattern

Configuration

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

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

Rule Details

Disallow empty destructuring patterns. Empty destructuring patterns do not create any variables and may be a sign of a mistake.

Examples of incorrect code for this rule:

var {} = foo;
var [] = foo;
var {
  a: {},
} = foo;
var {
  a: [],
} = foo;
function foo({}) {}
function foo([]) {}

Examples of correct code for this rule:

var { a } = foo;
var [a] = foo;
var { a = {} } = foo;
var {
  a: { b },
} = foo;
function foo({ a }) {}
function foo([a]) {}

Options

  • allowObjectPatternsAsParameters: If true, allows empty object patterns as function parameters. Default: false.

Original Documentation

https://eslint.org/docs/latest/rules/no-empty-pattern