sindresorhus/eslint-plugin-unicorn

Rule proposal: Prefer destructuring defaults to Object.assign/rest

Geschlossen

#1.538 geöffnet am 02.10.2021

 (10 Kommentare) (3 Reaktionen) (0 zugewiesene Personen)JavaScript (468 Forks)user submission
help wantednew rule

Repository-Metriken

Stars
 (5.022 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 4h 30m) (26 gemergte PRs in 30 T)

Beschreibung

I found this pattern and it looked like it could be standardized, but it probably isn't very common.

Fail

  const { foo, bar } = {
    foo: false,
    bar: 1,
    ...options,
  };

Pass

  const { foo = false, bar = 1} = options;

Contributor Guide