Skip to content

Instantly share code, notes, and snippets.

@michchan
Last active October 21, 2020 11:04
Show Gist options
  • Save michchan/68783ede5612078420a3b001b4979d58 to your computer and use it in GitHub Desktop.
Save michchan/68783ede5612078420a3b001b4979d58 to your computer and use it in GitHub Desktop.
Some search-and-replace snippets for fixing eslint problems

1. "line-comment-position": "above"

Search:

(\s+)([a-zA-Z0-9])(.+)([a-zA-Z0-9,;]) // (.+)

Replace:

$1// $5
$1$2$3$4

2. "prefer-destructuring"

Search:

([a-zA-Z0-9_\-\.]+) = ([a-zA-Z0-9_\-\.]+)\[0\]$

Replace:

[$1] = $2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment