Skip to content

I see dead code πŸ’€

Compare
Choose a tag to compare
@nicoespeon nicoespeon released this 23 Sep 00:00

Added

  • [New Refactoring] Remove Dead Code
  • [New Refactoring] Convert For-Loop to ForEach

Changed

Inline Variable now handles destructured object patterns

Consider the following code:

const { userId } = session;
messages.map(message => ({ userId }));

If you tried to inline userId, it wouldn't work because destructured object patterns were not supported.

Now it would work as expected:

messages.map(message => ({ userId: session.userId }));

Thanks to @noway for bringing this one up.

Destructured array patterns (e.g. const [userId] = session) are still not supported, but we're working on it.

Fixed

  • Convert If/Else to Ternary now preserve comments that were inside each branches.