~/talk

How To (Semi-)Automate JavaScript Refactoring

Talkat Fluent 2013 · 2013-05-28..05-30· [javascript, developer-experience]
links:none on file
slides:none on file

Shows how to automate refactoring by scanning code for repeated patterns, extracting variant tokens with a parser, and applying simple filter scripts or Node stream transforms to template and replace duplicates. Demonstrates using grep/wc and git-history analysis to prioritize files, reports 37 spec failures from changing one brittle line, and claims a project removed 1000 lines in a week and reformatted 700 HTML files in two weeks. Uses JSLint scraping, Ruby and JS parsers (recommend Esprima), and fast set‑intersection for similarity detection.

AI-written summary · about

  1. 0:00AUTOMATED REFACTORING
  2. 1:08NEW FUNCTIONALITY?
  3. 1:23NOT REFACTORING
  4. 2:26WHAT'S THIS FUNCTION?
  5. 2:47SPECS!
  6. 10:46REMOVED 1000 LINES OF CODE
  7. 11:471. KNOW YOUR CODE BASE
  8. 12:00CHOOSE A BROKEN PATTERN TO FIX
  9. 12:20SCAN CODE BASE WITH grep / awk / ag / ETC
  10. 14:18PARAMETERIZE THE HARD-CODED
  11. 14:28CLEAN THE CODE BY HAND
  12. 14:38WRITE FILTER SCRIPTS
  13. 15:49REDESIGN
  14. 16:00STREAMS
  15. 16:11REFORMATTED
  16. 20:11JS LINT
  17. 25:08Wrap function definitions in wrapper functions
  18. 29:25BAD CODE
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.