# Jack Franklin

Published articles for Jack Franklin.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## AI loops: who pays for the tokens?

DevFeed: [AI loops: who pays for the tokens?](<https://devfeed.tech/articles/ai-loops-who-pays-for-the-tokens-52593.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/who-pays-for-the-tokens/>)

Published: 2026-06-28T00:00:00Z

Content type: opinion

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [AI Agent](<https://devfeed.tech/topics/ai-agent.md>), [Finance](<https://devfeed.tech/topics/finance.md>), [Prompt Engineering](<https://devfeed.tech/topics/prompt-engineering.md>), [iteration](<https://devfeed.tech/topics/iteration.md>), [Tool](<https://devfeed.tech/topics/tool.md>), [Claude](<https://devfeed.tech/topics/claude.md>), [Dark Mode](<https://devfeed.tech/topics/dark-mode.md>)

Tags: [advice](<https://devfeed.tech/tags/advice.md>), [agent](<https://devfeed.tech/tags/agent.md>), [agents](<https://devfeed.tech/tags/agents.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-features](<https://devfeed.tech/tags/ai-features.md>), [anthropic](<https://devfeed.tech/tags/anthropic.md>), [boris-cherny](<https://devfeed.tech/tags/boris-cherny.md>), [chrome](<https://devfeed.tech/tags/chrome.md>), [claude](<https://devfeed.tech/tags/claude.md>), [claude-code](<https://devfeed.tech/tags/claude-code.md>), [css](<https://devfeed.tech/tags/css.md>), [dark-mode](<https://devfeed.tech/tags/dark-mode.md>), [discount](<https://devfeed.tech/tags/discount.md>), [free](<https://devfeed.tech/tags/free.md>), [google](<https://devfeed.tech/tags/google.md>), [loops](<https://devfeed.tech/tags/loops.md>), [models](<https://devfeed.tech/tags/models.md>), [openai](<https://devfeed.tech/tags/openai.md>), [openclaw](<https://devfeed.tech/tags/openclaw.md>), [tokens](<https://devfeed.tech/tags/tokens.md>)

### AI overview

AI loops let an agent pursue a high-level goal through repeated decisions, implementation and verification, but a pay-as-you-go setup can make that approach costly. The author spent $105.92 using an agent to reorganize CSS for a side project, a useful but nonurgent task, and judged the expense poor value. They contrast that with work at Google, where Antigravity CLI feels productive because token costs are effectively invisible, and personal use of Claude Code on a Claude Pro plan, where token limits encourage more selective use. The author argues that advice about AI use reflects who bears the cost, urges readers to consider that context and read a range of views, and cautions against spending to keep up.

### Source excerpt

A recent trend in AI has become this idea of "loops". Rather than you doing prompting and working with the AI to design and implement, you instead give it a higher level goal and let it roll. You build a system to let the AI make decisions, build and verify its work, all with the aim of completing your goal. As Addy Osmani puts it: A loop here can be thought of a recursive goal where you define a purpose and the AI iterates until complete. This has been an approach pushed by Peter Steinberger (OpenClaw, OpenAI) and Boris Cherny (Claude Code, Anthropic). Regardless of if you agree or disagree with this particular approach, I wanted to write about this and how when it comes to AI, you must consider the context of who is giving you advice because a person's circumstances can make a huge difference to how they encourage AI usage. A disclaimer: I am one of these people! It would be unfair of me to not point out that I am probably a person with an opinion on AI you should be wary of because: I work at Google, I am encouraged to adopt AI in my workflow, and I do not pay for any tokens or have any limits on token consumption (at least to a practical level). I work on AI features in Chrome Tooling; my job is to help people achieve more with the help of AI. Please have this in mind as you read this article - but also remember that this blog post and all others on this site are solely my personal opinion. It's easy to spend money when using AI Outside of work - where I do not get any discount/free plans for Google models - I was experimenting with a few "pay as you go" agents and mistakenly for one agent I provided payment details and forgot to set an upper limit on spend. I set out to use AI to help rework CSS in my side project; the CSS was a mess and I wanted to move to a system of variables and defined colours so I could easily support light and dark mode in the future. This was work that was valuable, but not critical or important to get done in one go. By the end of my p

## ai-review: reviewing AI code before it lands

DevFeed: [ai-review: reviewing AI code before it lands](<https://devfeed.tech/articles/ai-review-reviewing-ai-code-before-it-lands-52437.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/ai-review-plan/>)

Published: 2026-06-07T00:00:00Z

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [AI-assisted coding](<https://devfeed.tech/topics/ai-assisted-coding.md>), [Code review](<https://devfeed.tech/topics/code-review.md>), [ai code review](<https://devfeed.tech/topics/ai-code-review.md>), [Claude Code](<https://devfeed.tech/topics/claude-code.md>)

Tags: [agent](<https://devfeed.tech/tags/agent.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-agent](<https://devfeed.tech/tags/ai-agent.md>), [ai-code](<https://devfeed.tech/tags/ai-code.md>), [ai-tools](<https://devfeed.tech/tags/ai-tools.md>), [browser](<https://devfeed.tech/tags/browser.md>), [claude](<https://devfeed.tech/tags/claude.md>), [claude-code](<https://devfeed.tech/tags/claude-code.md>), [cli](<https://devfeed.tech/tags/cli.md>), [code](<https://devfeed.tech/tags/code.md>), [code-review](<https://devfeed.tech/tags/code-review.md>), [developer](<https://devfeed.tech/tags/developer.md>), [feedback](<https://devfeed.tech/tags/feedback.md>), [gemini](<https://devfeed.tech/tags/gemini.md>), [gemini-cli](<https://devfeed.tech/tags/gemini-cli.md>), [git](<https://devfeed.tech/tags/git.md>), [github](<https://devfeed.tech/tags/github.md>), [ide](<https://devfeed.tech/tags/ide.md>), [ides](<https://devfeed.tech/tags/ides.md>), [review](<https://devfeed.tech/tags/review.md>)

### AI overview

ai-review lets developers using terminal AI agents review plans and git diffs in a browser, where they can leave line-specific and general comments that are passed back into the agent conversation. The described workflow uses `/review-plan` to assemble and iteratively revise a plan before implementation, then `/review-diff` to inspect and comment on the resulting changes. The excerpt says to install `@jackfranklin/ai-review` globally with npm and add the `/review-plan` skill; full instructions are on GitHub.

### Source excerpt

Over the years I have become very comfortable as a developer who spends most of his time in the terminal. I've spent far too long tweaking my dotfiles to make things just how I like, and I have been a Vim/Neovim user for the best part of fifteen years. This trend has continued into the AI era. I've tried various IDEs and UI tools, but I always come back to Claude Code, Gemini CLI, and others. The problem with terminal AI tools There is one area where I have always been jealous of IDE users: reviewing AI plans and code. Claude will present a plan in the terminal, but it's just hard to review in detail, and I cannot highlight specific lines to leave feedback on. The same problem hits once the code is written -- scrolling through a terminal diff isn't fun nor is it a good way to spot problems, at least not for me. So, I built ai-review. AI Review offers you a way to review the plan, or a git diff, in the browser. You can leave line by line feedback, and have space for general comments too. Once you're done, your comments and the lines they reference are passed straight back into the conversation for the agent to act on. This gives you the comfort of a terminal AI agent, with the ability to intuitively review the plan in the browser, using your mouse and keyboard. My workflow is now: Planning phase: Work with the AI to plan a piece of work. Prompt the AI: /review-plan put the final plan together Once it loads up in the browser, I review and leave feedback. I can repeat these steps until I am happy. The AI implements the plan. Code review phase: Prompt the AI: /review-diff let me review your code Review the diff in the browser, and leave line-by-line comments. Repeat until happy :) If you're more of a visual learner, I recorded a video which shows my workflow for reviewing plans with this tool. Using it You can find full instructions on GitHub but the TLDR is: npm install -g @jackfranklin/ai-review (note: the npm package is just @jackfranklin/ai-review, not ai-review-plan

## Tracking feedback with Claude Code

DevFeed: [Tracking feedback with Claude Code](<https://devfeed.tech/articles/tracking-feedback-with-claude-code-52451.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/claude-code-ai-feedback-skill/>)

Published: 2026-04-24T00:00:00Z

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Claude Code](<https://devfeed.tech/topics/claude-code.md>), [pair\_programming](<https://devfeed.tech/topics/pair-programming.md>), [Agent Skills](<https://devfeed.tech/topics/agent-skills.md>), [Tool](<https://devfeed.tech/topics/tool.md>), [To-Do](<https://devfeed.tech/topics/todo.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [bug](<https://devfeed.tech/tags/bug.md>), [bugs](<https://devfeed.tech/tags/bugs.md>), [claude](<https://devfeed.tech/tags/claude.md>), [claude-code](<https://devfeed.tech/tags/claude-code.md>), [debugger](<https://devfeed.tech/tags/debugger.md>), [feedback](<https://devfeed.tech/tags/feedback.md>), [game](<https://devfeed.tech/tags/game.md>), [markdown](<https://devfeed.tech/tags/markdown.md>), [markdown-files](<https://devfeed.tech/tags/markdown-files.md>), [sqlite](<https://devfeed.tech/tags/sqlite.md>), [tokens](<https://devfeed.tech/tags/tokens.md>), [tracking](<https://devfeed.tech/tags/tracking.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

For playtesting OnTrack, the author first used Claude Code to collect notes in Markdown, where Claude grouped feedback, detected duplicates, and refined related items. As the lists grew to thousands of lines, even simple queries required reading whole files. The author replaced that workflow with a custom skill backed by a Deno CLI and SQLite: records hold titles, details, priority, status, category, project, and a completion flag. Completed items remain available as history but are hidden from default listings. The skill guides Claude to list titles and IDs before fetching details, check for related feedback before adding items, and infer the project from context when clear. The excerpt says this made targeted backlog queries faster and more accurate; it does not provide broader performance measurements.

### Source excerpt

I've been using Claude Code as a pair programmer, debugger, and feedback collector while I playtest my game, OnTrack. The setup has worked so well that I ended up building a small custom skill to make it scale and in this post I'll take you through how it works. (That last DevBlog was in 2024 (!), but I have continued to work on the game -- with AI my pace and progress has quickened, even if overall I've less time since becoming a dad.) Pausing development to playtest After a period of development, I like to do a playtest. I resist fixing things, and instead I play the game for an hour, noting down bugs, thoughts and suggestions as I go. I used to do this in a Trello board, but I recently decided to try using Claude as my bug collecting coworker and collate feedback in a markdown file. This worked really well! One of the benefits of using Claude is that it was able to detect similar feedback, or duplicates, or re-write old feedback to incorporate new points that were related. It also grouped them as it went under different categories such as UI, mechanics, or "quick wins". The problem of large Markdown files As I then followed these playtesting sessions with fixes, I asked Claude to mark feedback as complete by moving it into a separate document. In one hour of playtesting I would easily pick up on 50+ issues I wanted to fix (the game is far from done!) and one day I realised that the Markdown file with incomplete items was 3,000 lines long, and the one with completed items was 4,000 lines long! Claude was managing this fine - but I could see that as time grew, this list would become hard to manage, eat up more of my tokens, and become inefficient. Asking Claude to list the outstanding issues, or all the issues under a particular category, required it to read the entire Markdown file, even if I was only asking about a subset. The solution: SQLite I needed a way to store this data in a more structured form where Claude could query it more efficiently -- for example, ge

## Augmented engineering: learnings of an AI skeptic

DevFeed: [Augmented engineering: learnings of an AI skeptic](<https://devfeed.tech/articles/augmented-engineering-learnings-of-an-ai-skeptic-52580.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/using-ai-responsibly/>)

Published: 2025-05-06T00:00:00Z

Content type: opinion

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [generative-ai-tools](<https://devfeed.tech/topics/generative-ai-tools.md>), [AI Chat](<https://devfeed.tech/topics/ai-chat.md>), [Boilerplate](<https://devfeed.tech/topics/boilerplate.md>), [Developer experience](<https://devfeed.tech/topics/developer-experience.md>), [interactive web graphics](<https://devfeed.tech/topics/interactive-web-graphics.md>), [browser-game](<https://devfeed.tech/topics/browser-game.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [learnings](<https://devfeed.tech/tags/learnings.md>), [productivity](<https://devfeed.tech/tags/productivity.md>), [software-development](<https://devfeed.tech/tags/software-development.md>)

### AI overview

The author found AI most useful for getting unstuck and automating repetitive code, while treating its output as fallible. ChatGPT helped derive canvas arc angles and a starter implementation for curved track in the OnTrack game; Copilot then accurately filled in similar directional branches. The author estimates the work took 2-3 hours with AI versus at least 5-6 without, though generated code still needed codebase-specific tweaks. Other useful cases include exploring implementation options, recalling syntax in less familiar languages, making disposable scripts or prototypes, looking up CLI arguments, and soliciting code review ideas. The author recommends reviewing and testing generated code carefully, writing tests oneself, experimenting with prompts and tools, and sharing results with colleagues. They report using codecompanion.nvim and parrot.nvim in Neovim, while noting that browser-based AI works better for some people.

### Source excerpt

Since ChatGPT burst onto the scene in November 2022 it and its competitors have taken software development by storm. We've seen companies go all in on AI and set expectations that new hires will only be prioritised if AI can't do the job. This has caused a general level of anxiety amongst software engineers that their roles and disciplines could be under threat. Avoiding the initial hype train I mostly watched the bandwagon grow from a distance; staying focused on my work without a real desire to reach into the AI world. My early experiments were not fruitful, the code generated by AI (by which I mean ChatGPT, Claude, Gemini - I tried all of them!) was mostly OK, but I lost just as much time to tracking down subtle bugs in their generated code than I saved having them generate code. Of course, this assumes that I never write subtle bugs in my own code, so one could argue that it was still a time saver. But I didn't see the magic that others were seeing in their day to day workflows. Dipping my toes with curves and canvas The first time I began to see a productivity boost was from working on my browser based game OnTrack. The game is represented as a 2D map drawn on a canvas, and I wanted to draw nice curved track pieces. The problem was that I had long removed my school trigonometry lessons from my head, and I wasn't about to open that can of worms - at least, as much as I could avoid it! On a whim I decided to ask ChatGPT and see if it could give me a head start. So I asked it (in one chat) the following 3 questions (I've omitted some of the response to focus on the important parts): What angles do I use to draw a 90 degree curve that goes clockwise from 12 o'clock to 3 o'clock: So, you would start your curve at 0 degrees and end it at -90 degrees to achieve the desired effect. What is 0 degrees and -90 degrees in radians? The curve from 0 degrees to -90 degrees is equivalent to a curve from 0 radians to -pi/2 radians. Can you give me the HTML canvas code to draw t

## Goals for 2025

DevFeed: [Goals for 2025](<https://devfeed.tech/articles/goals-for-2025-52484.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/goals-for-2025/>)

Published: 2024-12-23T00:00:00Z

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [browser-game](<https://devfeed.tech/topics/browser-game.md>), [Sports](<https://devfeed.tech/topics/sports.md>), [To-Do](<https://devfeed.tech/topics/todo.md>)

Tags: [2025](<https://devfeed.tech/tags/2025.md>), [blog](<https://devfeed.tech/tags/blog.md>), [browser](<https://devfeed.tech/tags/browser.md>), [exercise](<https://devfeed.tech/tags/exercise.md>), [fitness](<https://devfeed.tech/tags/fitness.md>), [focus](<https://devfeed.tech/tags/focus.md>), [game](<https://devfeed.tech/tags/game.md>), [goals](<https://devfeed.tech/tags/goals.md>), [health](<https://devfeed.tech/tags/health.md>), [launch](<https://devfeed.tech/tags/launch.md>), [leo](<https://devfeed.tech/tags/leo.md>), [logistics](<https://devfeed.tech/tags/logistics.md>), [network](<https://devfeed.tech/tags/network.md>), [parenting](<https://devfeed.tech/tags/parenting.md>), [side-project](<https://devfeed.tech/tags/side-project.md>), [sleep](<https://devfeed.tech/tags/sleep.md>), [steam](<https://devfeed.tech/tags/steam.md>), [v1](<https://devfeed.tech/tags/v1.md>), [weekly](<https://devfeed.tech/tags/weekly.md>), [writing](<https://devfeed.tech/tags/writing.md>)

### AI overview

After a year centered on adjusting to new parenthood, the author sets six goals for 2025: exercise at least three times a week, launch the browser-based train logistics game OnTrack on Steam, take Leo swimming monthly, continue a weekly date night, write ten blog posts, and improve productivity at work. For OnTrack, success means defining and publishing a purchasable first version, with no sales target; the author may use Tauri to package the browser game. The goals reflect hopes that nursery will free time for exercise and work, and a desire to protect time for family, their relationship, and writing.

### Source excerpt

As 2024 comes to a close, I wanted to take a moment to reflect on what has been the most incredible and challenging year of my life. In January our child Leo was born and our lifes as we knew them were changed forever. There is plenty to be written on the highs and lows of being new parents and without doubt it has been the most difficult and rewarding year of my life. This year it has been impossible to set routines and goals because our sole focus was Leo and adapting to parenting. Any other goals or accomplishments were secondary and whilst to some extent that will always be the case, I wanted to note down some goals I have for 2025 to hold myself accountable. Hopefully this time next year I'm smiling writing a post about how successful I've been! Exercise at least 3 times a week My health, both physically and mentally, has suffered this year from a lack of time to invest in myself. Weekly badminton sessions and long walks with Leo and the dog have kept things ticking over, but the lack of sleep, quick meals once Leo is asleep and having to balance parenting and returning back to work has had a negative impact on my fitness. With Leo at nursery in 2025, I hope to have more time during the week to exercise, and I'm starting with a goal of 3 times per week. I hope to do more, but if I can achieve this it will be a solid improvement over 2024. Launch my side project on Steam I've been working on OnTrack for over two years. It's a browser based train logistics game where you have to build a passenger network and balance customer satisfaction and finances. At times I have suffered from focusing on too many features and knowing how to wrap up a "v1". This year, I want to define and launch the first version. My definition of success here is that the game is on Steam and you can buy it. I have no expectation on sales or making any money, but it would be a huge achievement to meet this milestone. Because the game is browser based (I did venture into Rust before falling ba

## TypeScript enums and falsy values

DevFeed: [TypeScript enums and falsy values](<https://devfeed.tech/articles/typescript-enums-and-falsy-values-52575.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/typescript-enums-0-values/>)

Published: 2024-11-17T00:00:00Z

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [TypeScript](<https://devfeed.tech/topics/typescript.md>), [enum](<https://devfeed.tech/topics/enum.md>), [union types](<https://devfeed.tech/topics/union-types.md>), [conditionals](<https://devfeed.tech/topics/conditionals.md>), [Null-Safety](<https://devfeed.tech/topics/null-safety.md>), [if statement](<https://devfeed.tech/topics/if-statement.md>)

Tags: [boolean](<https://devfeed.tech/tags/boolean.md>), [bug](<https://devfeed.tech/tags/bug.md>), [code](<https://devfeed.tech/tags/code.md>), [condition](<https://devfeed.tech/tags/condition.md>), [conditional](<https://devfeed.tech/tags/conditional.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enums](<https://devfeed.tech/tags/enums.md>), [function](<https://devfeed.tech/tags/function.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [members](<https://devfeed.tech/tags/members.md>), [null](<https://devfeed.tech/tags/null.md>), [number](<https://devfeed.tech/tags/number.md>), [return](<https://devfeed.tech/tags/return.md>), [status](<https://devfeed.tech/tags/status.md>), [string](<https://devfeed.tech/tags/string.md>), [typescript](<https://devfeed.tech/tags/typescript.md>), [value](<https://devfeed.tech/tags/value.md>), [values](<https://devfeed.tech/tags/values.md>)

### AI overview

A numeric TypeScript enum starts at 0 by default, and JavaScript treats 0 as falsy. When a function returns an enum value or null, `if (status)` therefore mistakes the first enum member for "not logged in." The text recommends checking `status !== null`, or assigning enum members nonzero numeric values or nonempty strings so truthiness checks do not reject a valid status. It also notes that the issue can pass TypeScript compilation and mentions the TypeScript ESLint `strict-boolean-expressions` rule as a possible aid.

### Source excerpt

I recently lost an evening to debugging a subtle issue which highlights a potential pitfall in the interaction between TypeScript enums and "falsy" values in JavaScript. Let's look at a scenario that illustrates this problem: Spot the Bug Consider the following code where a function returns either an enum value or null depending on whether a user is logged in: const enum Status { Inactive, Active, Pending, } function getUserStatus(user?: User): Status | null { if (!user) { // No user is logged in. return null } return user.status() } function checkUserStatus(user?: User): void { const status = getUserStatus(userId) if (status) { console.log('User has a valid status:', status) } else { console.log('The user is not logged in.') } } What's the Issue? JavaScript has a concept of truthy and falsy values. In conditional statements, values that are considered falsy are treated as false. The list of falsy values in JavaScript include: false 0 "" (empty string) null undefined NaN This means that if(0) {} is always false in JavaScript. Now we can look at the default values assigned to enum members in TypeScript. As the TypeScript documentation states, when initializing enum values, the default values are numeric and start from 0. These two enums are equivalent: const enum Status { Inactive = 0, Active = 1, Pending = 2, } const enum Status { Inactive, Active, Pending, } This means that if an enum member is assigned the value 0, it will behave like false in any condition where truthiness is evaluated rather than explicitly checking for the null value. Solving with explicit checks To avoid this bug, explicitly check for null instead of relying on truthy checks: function checkUserStatus(user?: User): void { const status = getUserStatus(user) if (status !== null) { console.log('User has a valid status:', status) } else { console.log('The user is not logged in.') } } Solving with explicit enum values Alternatively, because each number in JavaScript that is not 0 is considered truth

## performance.wow() 2024

DevFeed: [performance.wow() 2024](<https://devfeed.tech/articles/performance-wow-2024-52429.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/2024-11-16-performance-now-conference.html>)

Published: 2024-11-16T00:00:00Z

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Developer Tools](<https://devfeed.tech/topics/developer-tools.md>), [Web](<https://devfeed.tech/topics/web.md>), [Google](<https://devfeed.tech/topics/google.md>)

Tags: [bug](<https://devfeed.tech/tags/bug.md>), [conference](<https://devfeed.tech/tags/conference.md>), [devtools](<https://devfeed.tech/tags/devtools.md>), [feature](<https://devfeed.tech/tags/feature.md>), [feedback](<https://devfeed.tech/tags/feedback.md>), [google](<https://devfeed.tech/tags/google.md>), [performance](<https://devfeed.tech/tags/performance.md>)

### AI overview

A reflection on performance.now() 2024, where the author discussed updates to the DevTools performance panel, gathered user feedback, and highlighted the value of focused web-performance conferences.

### Source excerpt

As I write this blog post I am sat in an AirBnB in Utrecht reflecting on two incredibly inspiring days at performance.now() 2024. I was not only fortunate to attend but to be asked to talk, and it was a real privilege to get the chance to update the attendees on all our recent work updating the performance panel with a myriad of new features. Image courtesy of Estela Franco on Bluesky Being present at this conference is an energy boost; a reminder that I am very fortunate to work on a tool that many people use on a daily basis to help them get their work done. It is an absolute privilege to be the person responsible for the (mostly technical) direction of the performance tools in DevTools and the desire to continue working to improve further is only heightened by spending time with our users face to face. A huge thank you to everyone who attended and who spoke to me or other Googlers with their feedback - both the good and the bad - on what we can do better. I joined Google and the DevTools team because I'd spent ten years using the DevTools daily through from university to my first few tech jobs and even after nearly five years the motivation to keep improving our tools so that everyone can improve their effectiveness is very strong. If you didn't get a chance to speak to us face to face, you can always file a bug or feature request to bring it to our attention. I promise that a human (most likely me!) reads all the performance tooling related submissions we get. If you are interested in performance on the web, I can't recommend performance.now() enough. I have realised that hyper-focused conferences are the most impactful and this is a great example. You don't have to familiar with performance either; the community is encouraging, friendly and wants to welcome folks in and help them gain the expertise to level up the web for everyone. If you'd like a deeper summary of all the talks, Stuart McMillan's blog post is a fantastic read.

## OnTrack devlog 1

DevFeed: [OnTrack devlog 1](<https://devfeed.tech/articles/ontrack-devlog-1-52464.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/devlog-javascript-ontrack-1/>)

Published: 2024-04-08T00:00:00Z

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [browser-game](<https://devfeed.tech/topics/browser-game.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [Finance](<https://devfeed.tech/topics/finance.md>), [User interface design](<https://devfeed.tech/topics/ui-design.md>)

Tags: [blog](<https://devfeed.tech/tags/blog.md>), [browser](<https://devfeed.tech/tags/browser.md>), [challenge](<https://devfeed.tech/tags/challenge.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [factorio](<https://devfeed.tech/tags/factorio.md>), [financial](<https://devfeed.tech/tags/financial.md>), [game](<https://devfeed.tech/tags/game.md>), [logistics](<https://devfeed.tech/tags/logistics.md>), [map](<https://devfeed.tech/tags/map.md>), [networks](<https://devfeed.tech/tags/networks.md>), [openttd](<https://devfeed.tech/tags/openttd.md>), [people](<https://devfeed.tech/tags/people.md>), [revenue](<https://devfeed.tech/tags/revenue.md>), [steam](<https://devfeed.tech/tags/steam.md>), [strategy](<https://devfeed.tech/tags/strategy.md>), [technology](<https://devfeed.tech/tags/technology.md>), [train](<https://devfeed.tech/tags/train.md>), [transport](<https://devfeed.tech/tags/transport.md>), [ui](<https://devfeed.tech/tags/ui.md>), [with](<https://devfeed.tech/tags/with.md>)

### AI overview

OnTrack is an unfinished, browser based train network game focused on passenger travel, satisfaction, and company revenue. Players connect towns with track, plan routes and schedules, choose train sizes, and inspect passenger travel demand to avoid costly empty trains. Its engineering window limits how many changes players can make each night; trains run during the day, when track and orders cannot be changed. Contracts offer an early reward and hint at where to begin. The developer says the game has no end state yet and needs more work to become playable and sustain longer play. It is currently played in a browser, with packaging through Electron, Tauri, or another web technology wrapper described as a long term possibility.

### Source excerpt

If you were to look at my Steam library you would see that most of my games are strategy and logistics based (think Factorio) but with a healthy dose of transport methods and networks (think Transport Fever 2 and OpenTTD). I've always wanted a very specific, niche game focusing on building passenger networks that simulate how passengers travel - something I have never quite been satisifed with in OpenTTD, Transport Fever 2, and other games that I've played. I like the logistical challenge of moving cargo around, but it didn't interest me as much as the idea of moving people across a map. So, I decided to build it... Meet OnTrack For over two years I have been working on an in-browser, web technology based game all about running train networks and optimising them for passenger satisfaction and financial revenue. It's far from complete, but also at the point where it sort of looks like a game, and a couple of people have been able to spend some hours on it. There is no end state, and a lot of work needs to go into the longevity of the game, but this is what it looks like... remember, this is far from finished, or even polished :) In future posts, I will dive more into each of the systems the game has to provide a (hopefully!) challenging and enjoyable experience for players. In this post I'll give you a very quick overview. First, you start a new game. Here you have a few options, but you're mainly rerolling until you get a start you're happy with: Once you have a new game, you are taken into the main UI and the game map: The goal here is to begin to connect towns with track, at which point you can run routes and trains on them. At the start of the game you are given some nudges with a contract - the completion of which earns you a reward: This contract is usually a hint at where to start, because you have limited time to do so... The engineering window In most logistics games at any point you can pause the game, make changes, and then start it up. You can avoid a hug

## Exhaustive branch checks with TypeScript

DevFeed: [Exhaustive branch checks with TypeScript](<https://devfeed.tech/articles/exhaustive-branch-checks-with-typescript-52577.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/typescript-exhaustive-branches/>)

Published: 2024-03-04T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [TypeScript](<https://devfeed.tech/topics/typescript.md>), [exhaustive matching](<https://devfeed.tech/topics/exhaustive-matching.md>), [union types](<https://devfeed.tech/topics/union-types.md>), [enum](<https://devfeed.tech/topics/enum.md>)

Tags: [argument](<https://devfeed.tech/tags/argument.md>), [branch](<https://devfeed.tech/tags/branch.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [enum](<https://devfeed.tech/tags/enum.md>), [error](<https://devfeed.tech/tags/error.md>), [exhaustive](<https://devfeed.tech/tags/exhaustive.md>), [function](<https://devfeed.tech/tags/function.md>), [parameter](<https://devfeed.tech/tags/parameter.md>), [switch](<https://devfeed.tech/tags/switch.md>), [type](<https://devfeed.tech/tags/type.md>), [typescript](<https://devfeed.tech/tags/typescript.md>), [union](<https://devfeed.tech/tags/union.md>)

### AI overview

When branching on a TypeScript union or enum, add a `default` branch that calls `ensureExhaustive(value)`, a helper accepting `never`. If the type later gains a value that the branches do not handle, TypeScript reports that the value is not assignable to `never` and identifies the missing variant. This can catch unhandled cases even in `void` functions, where a missing branch may otherwise produce no error. The excerpt says the same approach works with narrowed `if`/`else` branches. The helper throws at runtime if reached.

### Source excerpt

It's very common when working with TypeScript that you will have a type that declares a list of values, such as an enum or union type: enum SupportedColour1 { RED, YELLOW, BLUE, } type SupportedColour2 = 'RED' | 'YELLOW' | 'BLUE' And then you will often have functions that need to run differently or return different values based on what variant is passed in: function codeForColour1(colour: SupportedColour1): string { switch (colour) { case SupportedColour1.BLUE: return '#0000ff' case SupportedColour1.RED: return '#ff0000' case SupportedColour1.YELLOW: return '#ffff00' } } function codeForColour2(colour: SupportedColour2): string { switch (colour) { case 'BLUE': return '#0000ff' case 'RED': return '#ff0000' case 'YELLOW': return '#ffff00' } } Updating code when types change One thing that can catch you out is if the list of valid values in the type changes. Let's say we want to add GREEN as a value to our union type (I will drop the enum example for brevity, but the functionality for the sake of this post is equivalent): type SupportedColour2 = 'RED' | 'YELLOW' | 'BLUE' | 'GREEN' In this case we will now get an error in this function. TypeScript will realise that the function does not return anything in the case that GREEN is passed in, but the error is not very obvious: function codeForColour2(colour: SupportedColour2): string { switch (colour) { case 'BLUE': return '#0000ff' case 'RED': return '#ff0000' case 'YELLOW': return '#ffff00' } } Function lacks ending return statement and return type does not include 'undefined'. If the function did not return a value, TypeScript will not error and it would be easy to miss that we now have a branch (for GREEN) that is not dealt with: // This will not error in TypeScript, even though we are not // dealing with the GREEN case. function logForColour(colour: SupportedColour2): void { switch (colour) { case 'BLUE': console.log('User picked blue') case 'RED': console.log('User picked red') case 'YELLOW': console.log('User picked

## Cracking Neovim code folding

DevFeed: [Cracking Neovim code folding](<https://devfeed.tech/articles/cracking-neovim-code-folding-52453.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/code-folding-in-vim-neovim/>)

Published: 2024-02-29T00:00:00Z

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Neovim](<https://devfeed.tech/topics/neovim.md>), [Tree-sitter](<https://devfeed.tech/topics/tree-sitter.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [Syntax Highlighting](<https://devfeed.tech/topics/syntax-highlighting.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [folding](<https://devfeed.tech/tags/folding.md>), [neovim](<https://devfeed.tech/tags/neovim.md>)

### AI overview

The author settles on Neovim's built-in folding with Tree-sitter as the fold source, using `foldmethod = "expr"` and `foldexpr = "v:lua.vim.treesitter.foldexpr()"` because some codebases lack an LSP. They disable the fold column (`foldcolumn = "0"`), use empty `foldtext` for syntax-highlighted fold lines (noting this works only in Neovim nightly, not stable 0.9.x), and set `foldlevel = 99`, `foldlevelstart = 1`, and `foldnestmax = 4` to open top-level folds initially and limit deep nesting. They rely on `zR` to open all folds, `zM` to close them, and `za` to toggle at the cursor; they are still learning `zk` and `zj`. They tried `nvim-ufo` but found it slower and "janky," while acknowledging others may have a different experience.

### Source excerpt

I have used Vim or variants like Neovim ever since the second year of university, which means I've been using Vim for nearly 13 years (!). In that time I have gotten very comfortable navigating my way through code and codebases using Vim, and migrating to Neovim and its LSP setup has replicated an experience very close to what VS Code provides, but with all the benefits (in my opinion) of Vim. One feature that I have never been able to get confident with is code folding. I relied on it a lot during my roughly year long stint of VSCode + Vim mode but just could not get a satisifying configuration and set of commands to make it stick in Vim...until now! The first step was Andrew Courter's video on code folding which helped me get some basic settings in place and understand my different options for how folding should work in Neovim. Neovim is able to use many sources of truth for folds, from basic options like code indentation, through to LSP servers supplying that information. Andrew recommends the plugin nvim-ufo, but when I tried it I found it decreased performance and felt "janky" - your mileage may vary as it's clearly a popular plugin! Folding configuration From Andrew's video I decided to try and set up folding again - firstly using the UFO plugin as described above - before then deciding that I wanted to stick to what was built in. After some experimentation I found the best combination of settings that work for me: foldmethod and foldexpr I chose to use treesitter as my source of truth for folding. I chose this over the LSP option as I don't always work in codebases that have an LSP configured - especially if I am quickly hacking on a script. By using the treesitter grammar, I ensure every file I load will have it. vim.opt.foldmethod = "expr" vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" foldcolumn I don't like taking up room with an extra column to display information on folds, so I turn this off. vim.opt.foldcolumn = "0" foldtext By setting this to an

## Running command line tasks in Neovim

DevFeed: [Running command line tasks in Neovim](<https://devfeed.tech/articles/running-command-line-tasks-in-neovim-52475.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/executing-tasks-in-neovim/>)

Published: 2022-07-23T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Neovim](<https://devfeed.tech/topics/neovim.md>), [Terminal](<https://devfeed.tech/topics/terminal.md>), [Unit testing](<https://devfeed.tech/topics/unit-testing.md>)

Tags: [build](<https://devfeed.tech/tags/build.md>), [built-in](<https://devfeed.tech/tags/built-in.md>), [command-line](<https://devfeed.tech/tags/command-line.md>), [commands](<https://devfeed.tech/tags/commands.md>), [config](<https://devfeed.tech/tags/config.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [custom](<https://devfeed.tech/tags/custom.md>), [neovim](<https://devfeed.tech/tags/neovim.md>), [plugin](<https://devfeed.tech/tags/plugin.md>), [right](<https://devfeed.tech/tags/right.md>), [run](<https://devfeed.tech/tags/run.md>), [running](<https://devfeed.tech/tags/running.md>), [send](<https://devfeed.tech/tags/send.md>), [setup](<https://devfeed.tech/tags/setup.md>), [split](<https://devfeed.tech/tags/split.md>), [tasks](<https://devfeed.tech/tags/tasks.md>), [terminal](<https://devfeed.tech/tags/terminal.md>), [test](<https://devfeed.tech/tags/test.md>), [tests](<https://devfeed.tech/tags/tests.md>), [things](<https://devfeed.tech/tags/things.md>)

### AI overview

The article builds a repeatable task runner around Neovim's terminal and the Neoterm plugin. It configures a right-side vertical terminal at about 30% width, with key mappings for moving between splits and automatic insert mode on entry. Neoterm's `:T` reuses a terminal; the workflow targets terminal 1 with `:1T` and clears it with `:1Tclear` before each run. A Lua `TaskPersist` command prompts once for a saved task using nui.nvim's input component, then reruns it; optional arguments run one-off commands without replacing the saved task. A separate `SetTaskCommand` command prompts to reset the saved task. The article notes that some shown configuration is Vimscript awaiting migration to Lua.

### Source excerpt

My daily workflow often involves repeatedly running tasks, whether that be build commands, unit tests, or some other scripts. My ideal workflow is to have a terminal split on the right hand side, and then be able to send tasks to it. The built in terminal Neovim's built in :terminal allows me to easily open a terminal as a split in Neovim, and I have a few custom keymaps to jump to and from it. Rather than use <C-w>{h,j,k,l} to navigate splits, I remap to <C-{h,j,k,l>, and I add the same mappings to the terminal splits, along with mapping <Esc>: tnoremap <Esc> <C-\><C-n> tnoremap <C-h> <C-\><C-n><C-w>h tnoremap <C-j> <C-\><C-n><C-w>j tnoremap <C-k> <C-\><C-n><C-w>k tnoremap <C-l> <C-\><C-n><C-w>l I also prefer to always be in insert mode by default when entering a terminal split: autocmd BufEnter * if &buftype == 'terminal' | :startinsert | endif Neoterm plugin To make things a little easier to manage, I also use the Neoterm plugin. This gives me the ability to run: :T ls To open a terminal and execute the ls command. If you then run this command again, it will re-execute the terminal command but in the same terminal. You may start to see how this is going to form the building blocks of my setup of a terminal that I continuously execute tasks in... I can then set neoterm_size and neoterm_default_mod to define how the terminal appears. I set it to approximately 30% of the screen width, and to be vertical on the right hand side: vim.g.neoterm_size = tostring(0.3 * vim.o.columns) vim.g.neoterm_default_mod = 'botright vertical' This config is in Lua rather than Vimscript because I only use Neovim. The previous configuration code shown is due to be migrated but I've not got round to it yet! Mapping a key to execute a command I don't want to have to manually run :T my-command-here every time I want to run tests. So I started manually setting a shortcut when I would need to have a command setup, such as running tests: :nnoremap <leader>e :T npm test<CR> This worked well, b

## Learning to say "I don't know"

DevFeed: [Learning to say "I don't know"](<https://devfeed.tech/articles/learning-to-say-i-don-t-know-52513.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/learning-to-say-i-dont-know/>)

Published: 2022-07-07T00:00:00Z

Content type: opinion

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Developer Tools](<https://devfeed.tech/topics/developer-tools.md>), [Learning](<https://devfeed.tech/topics/learning.md>), [tracing](<https://devfeed.tech/topics/tracing.md>), [Google Chrome](<https://devfeed.tech/topics/google-chrome.md>), [Documentation](<https://devfeed.tech/topics/documentation.md>)

Tags: [canvas](<https://devfeed.tech/tags/canvas.md>), [chrome](<https://devfeed.tech/tags/chrome.md>), [chrome-devtools](<https://devfeed.tech/tags/chrome-devtools.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [json](<https://devfeed.tech/tags/json.md>), [know](<https://devfeed.tech/tags/know.md>), [lighthouse](<https://devfeed.tech/tags/lighthouse.md>), [performance](<https://devfeed.tech/tags/performance.md>), [team](<https://devfeed.tech/tags/team.md>), [traces](<https://devfeed.tech/tags/traces.md>), [website-performance](<https://devfeed.tech/tags/website-performance.md>)

### AI overview

After becoming a Chrome DevTools performance tooling lead, the author feared that admitting gaps in their knowledge would make them seem unqualified. Instead, they learned to say "I don't know" and find answers by examining trace files, consulting design documents or documentation, and asking knowledgeable colleagues. Reaching out both supplied answers and built relationships. The author's takeaway is that effective technical leadership means helping the team fill knowledge gaps, not knowing everything.

### Source excerpt

In October 2021 I took on a new role within the Chrome DevTools team as a Technical Lead (TL) of the DevTools Performance Tooling team, who are responsible for all things website performance inside of DevTools, the most well known being the Performance Panel. My journey to this point had begun a year prior when we started building a new panel that would come to be named Performance Insights. I was asked to build the panel, and for the first time in my career I came face to face with Chrome trace files. These are large JSON files that contain all the trace data that Chrome generates when asked to perform a trace, and it's these that contain the information that we parse and present in the DevTools panels. It's also part of what other tools like Lighthouse, or third-party tools like WebPageTest, use to display data. There was a lot of knowledge and information about performance that I didn't know. This is something that I'm never comfortable with, but as a contributor to the team I felt happy admitting to my manager (and TL of the team) when I didn't know things, and asking them to jump on a video call to walk me through something. I'd never even used the HTML Canvas API, which I had to learn along with the intricate details of Performance tracing. When I then became TL of the team, I was suddenly the person who people would ask questions to. On the first "official" day that I became TL, someone asked me a question about traces and how certain trace events are represented. I realised I didn't know, and I was going to have to admit it. But I'm the TL, I'm supposed to know that! I panicked; assuming that my lack of knowledge would now be unearthed and I'd quickly be "found out" as not being ready for this role. As you've probably guessed, none of that happened. I decided to embrace not knowing, and put my efforts into figuring out how to find out and fill the gaps in my own knowledge. Sometimes I could do that by spending thirty minutes reading a trace file and understa

## Why I don't miss React: a story about using the platform

DevFeed: [Why I don't miss React: a story about using the platform](<https://devfeed.tech/articles/why-i-don-t-miss-react-a-story-about-using-the-platform-52594.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/working-with-react-and-the-web-platform/>)

Published: 2022-05-03T00:00:00Z

Content type: opinion

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Front end](<https://devfeed.tech/topics/frontend.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>), [React](<https://devfeed.tech/topics/react.md>), [Developer Tools](<https://devfeed.tech/topics/developer-tools.md>), [Google Chrome](<https://devfeed.tech/topics/google-chrome.md>)

Tags: [chrome](<https://devfeed.tech/tags/chrome.md>), [chrome-devtools](<https://devfeed.tech/tags/chrome-devtools.md>), [components](<https://devfeed.tech/tags/components.md>), [control](<https://devfeed.tech/tags/control.md>), [development](<https://devfeed.tech/tags/development.md>), [devtools](<https://devfeed.tech/tags/devtools.md>), [e-commerce](<https://devfeed.tech/tags/e-commerce.md>), [frameworks](<https://devfeed.tech/tags/frameworks.md>), [frontend](<https://devfeed.tech/tags/frontend.md>), [google](<https://devfeed.tech/tags/google.md>), [platform](<https://devfeed.tech/tags/platform.md>), [react](<https://devfeed.tech/tags/react.md>), [recorder](<https://devfeed.tech/tags/recorder.md>), [software](<https://devfeed.tech/tags/software.md>), [the-web](<https://devfeed.tech/tags/the-web.md>), [ui](<https://devfeed.tech/tags/ui.md>), [web](<https://devfeed.tech/tags/web.md>), [web-components](<https://devfeed.tech/tags/web-components.md>), [web-platform](<https://devfeed.tech/tags/web-platform.md>)

### AI overview

After moving from a React-based startup frontend to Chrome DevTools, the author found Web Components easier to adopt than expected and valued using browser primitives and controlling when components render. A form example uses native validation, FormData, and optionally the Constraint Validation API, avoiding a dependency at the cost of writing some extra code. Custom Elements require building selected framework features, such as a scheduler and test helpers; the DevTools team chose a small scheduler and uses lit-html for efficient templates, citing its small size and replaceability. The author weighs dependencies by bundle size, upgrade effort, and maintenance risk, while acknowledging frameworks can provide valuable cross-browser compatibility. The piece presents this as one team's experience, not a general recommendation to replace React; project requirements differ, and native APIs are not always enough.

### Source excerpt

Just over two years ago I left a role at a London based startup where I lead development of a large, React based e-commerce frontend to join Google to work on Chrome DevTools. My initial focus was to introduce Web Components as the new fundamental building block of all new DevTools features and UI. With the recently launched Recorder panel along with others, there are now large parts of DevTools that are almost exclusively web components. When I left my React focused role behind I expected to find the transition hard, and miss what React had to offer. I've ended up finding the transition easier than expected and have come to really relish working closer to the platform's primitives and maintaining more control over the software I write and in this blog post I'd like to share why that is. Firstly, because some people on the internet like to get angry over opinions that may not match their own, I want to make clear what this blog post is not: It is not a call for everyone to immediately drop React and move to web components. It is not a blog post declaring React "dead", or the wrong choice for every project. It is not a blog post declaring web components the best solution to all projects. It is not a blog post declaring all web frameworks useless or a bad choice. It is not a blog post suggesting that, because this approach works for me and the team I'm on at Google, that it works for you. All projects are different, and Chrome DevTools almost certainly has a different set of requirements and constraints to your project. And that's fine :) This blog post should be read as the musings of someone who went from working with React every day to not touching it, and the experiences of doing so. I am writing this post because I have been pleasantly surprised on how much I've enjoyed working more closely with the web platform. Whilst I will use "React" as my comparison, you could reasonably substitute it for any of the large modern frameworks. Using the platform "Using the pla

## Why you should check-in your node dependencies

DevFeed: [Why you should check-in your node dependencies](<https://devfeed.tech/articles/why-you-should-check-in-your-node-dependencies-52450.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/check-in-your-node-dependencies/>)

Published: 2021-12-06T00:00:00Z

Content type: opinion

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Git](<https://devfeed.tech/topics/git.md>), [npm packages](<https://devfeed.tech/topics/npm-packages.md>), [npm](<https://devfeed.tech/topics/npm.md>), [Continuous integration](<https://devfeed.tech/topics/continuous-integration.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>)

Tags: [builds](<https://devfeed.tech/tags/builds.md>), [chrome-devtools](<https://devfeed.tech/tags/chrome-devtools.md>), [circleci](<https://devfeed.tech/tags/circleci.md>), [continuous-integration](<https://devfeed.tech/tags/continuous-integration.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [deploy](<https://devfeed.tech/tags/deploy.md>), [git](<https://devfeed.tech/tags/git.md>), [github-actions](<https://devfeed.tech/tags/github-actions.md>), [google](<https://devfeed.tech/tags/google.md>), [node](<https://devfeed.tech/tags/node.md>), [npm](<https://devfeed.tech/tags/npm.md>), [projects](<https://devfeed.tech/tags/projects.md>), [pull-request](<https://devfeed.tech/tags/pull-request.md>)

### AI overview

The author argues that checking `node_modules` into Git can speed setup and CI by eliminating `npm install`, keep developers on identical dependency files, and make dependency size and code more visible during review. This visibility can encourage more deliberate dependency choices. The tradeoff is noisy diffs, especially for large updates such as TypeScript. The author's team manages this by requiring dependency-only changes, with an override when an update also requires code fixes. Checking dependencies in Git also would have avoided immediate build disruption from the left-pad package removal, though unsupported dependencies would still need to be addressed.

### Source excerpt

On every team at every company I've been at prior to my current role, the advice was simple: don't check your node_modules folder into your version control system (which I'll refer to as "Git" for the rest of this article...). This seemed like solid advice for multiple reasons: The code within node_modules isn't authored by the team directly. The code within node_modules is often quite large and would cause a lot of noise in git diffs and pull requests. The code within node_modules can easily be replicated with an npm install. I currently work at Google on the Chrome DevTools team and we check our node_modules folder into source control. At first this struck me as unusual, but I've come to believe that there are some major benefits to this approach that I think more people should consider. No need for npm installs Once you check your node_modules in, there's no need to run an install step before you can get up and running on the codebase. This isn't just useful for developers locally, but a big boost for any bots you might have running on a Continuous Integration platform (e.g. CircleCI, GitHub Actions, and so on). That's now a step that the bots can miss out entirely. I've seen projects easily need at least 1-2 minutes to run a complete npm install from scratch - and on bots that could be even longer. If you think that a bot runs on every pull request and deploy, you could easily have 50+ bots run each day. That's a lot of minutes (and bandwidth!) saved. Guaranteed replicated builds Having your node_modules checked in guarantees that two developers running the code are running the exact same code with the exact same set of dependencies. Yes, this can be managed by a package-lock.json file, or other tools, but I've seen all of them slip up rarely or allow a slight variation in a minor version number that causes issues. Once the dependencies are in git, you cannot possibly run with anything other than those and each developer will be running the exact codebase. Better

## Working in small chunks

DevFeed: [Working in small chunks](<https://devfeed.tech/articles/working-in-small-chunks-52454.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/coding-javascript-small-chunks/>)

Published: 2021-03-09T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [To-Do](<https://devfeed.tech/topics/todo.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>), [Deployment Strategies](<https://devfeed.tech/topics/deployment-strategies.md>), [Linear](<https://devfeed.tech/topics/linear.md>)

Tags: [brain](<https://devfeed.tech/tags/brain.md>), [build](<https://devfeed.tech/tags/build.md>), [complete](<https://devfeed.tech/tags/complete.md>), [consider](<https://devfeed.tech/tags/consider.md>), [create](<https://devfeed.tech/tags/create.md>), [doc](<https://devfeed.tech/tags/doc.md>), [docs](<https://devfeed.tech/tags/docs.md>), [dump](<https://devfeed.tech/tags/dump.md>), [feature](<https://devfeed.tech/tags/feature.md>), [features](<https://devfeed.tech/tags/features.md>), [first](<https://devfeed.tech/tags/first.md>), [format](<https://devfeed.tech/tags/format.md>), [formatting](<https://devfeed.tech/tags/formatting.md>), [found](<https://devfeed.tech/tags/found.md>), [goals](<https://devfeed.tech/tags/goals.md>), [google](<https://devfeed.tech/tags/google.md>), [google-docs](<https://devfeed.tech/tags/google-docs.md>), [help](<https://devfeed.tech/tags/help.md>), [important](<https://devfeed.tech/tags/important.md>), [small](<https://devfeed.tech/tags/small.md>)

### AI overview

For features that take days or weeks, the author recommends writing down and continually updating small work steps so progress, open questions, and deferred ideas stay out of your head. Prioritize dependencies, risks to validate early, and work needing teammates. Ship changes incrementally, using feature flags and gradual rollout where possible, to reduce risk and make reviews more manageable. Commit at natural stopping points for recovery and backup; rebase and squash before review, then write a thorough final description. When interrupted, leave TODOs or notes and commit the current state so you can resume more easily.

### Source excerpt

Although occasionally you'll be given a task to complete which can be completed in no more than a few hours, most of your work is likely going to consist of features that will take multiple days or even weeks to complete. I've found that the longer a piece of work takes, the more likely I am to lose track of my progress, forget which part of the feature I was going to build next, or realise I've done work in the wrong order and have lost time because of it. Regardless of how easy or hard the new feature is to build, the longer it takes the more important it is to break the work down into manageable steps and make sure you keep on top of it. You cannot keep weeks worth of work in your head; taking the time upfront to plan your work will pay off, keeping your head clear to work on the feature and ensuring you have a sense of where you're at at any given point. In this post I'll share some strategies I've found useful to help me plan and stay productive when working on features that span multiple weeks and even months. Plan the small steps ahead of time The first thing I'll do when starting on a new feature is create a new document (this can be whatever format you prefer - I use Google Docs but know others who always use a pen and paper, it's really down to your personal preference) and write down a really rough list of bullet points that list all the different pieces of work I need to complete to consider the overall feature complete. This list is only for my eyes so I don't worry about formatting or structure and instead use it as a way to brain-dump everything I can think of that I need to do, or consider. Most features I work on are backed by a design doc, which lists the scope and goals of the work, so I'll refer to that when creating my list. Once I have this list, I can start to order it and decide which parts make sense to prioritise first. When deciding where to start I'm considering the following: Are there any parts of the project that need to be completed f

## Comparing Svelte and React

DevFeed: [Comparing Svelte and React](<https://devfeed.tech/articles/comparing-svelte-and-react-52456.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/comparing-svelte-and-react-javascript/>)

Published: 2021-03-09T00:00:00Z

Content type: comparison

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Svelte](<https://devfeed.tech/topics/svelte.md>), [React](<https://devfeed.tech/topics/react.md>)

Tags: [authentication](<https://devfeed.tech/tags/authentication.md>), [developer-experience](<https://devfeed.tech/tags/developer-experience.md>), [firebase](<https://devfeed.tech/tags/firebase.md>), [history](<https://devfeed.tech/tags/history.md>), [hooks](<https://devfeed.tech/tags/hooks.md>), [preact](<https://devfeed.tech/tags/preact.md>), [react](<https://devfeed.tech/tags/react.md>), [svelte](<https://devfeed.tech/tags/svelte.md>), [time-tracking](<https://devfeed.tech/tags/time-tracking.md>), [timer](<https://devfeed.tech/tags/timer.md>)

### AI overview

Based on rebuilding a small Pomodoro app, the author finds both React and Svelte productive and makes no claim that one is universally better. React hooks package Firebase authentication neatly, though the author notes that multiple components using the hook could create multiple auth listeners. Svelte's writable store offers a shared alternative with automatic subscription through `$`. For the timer's Web Worker, React requires a `useRef` to retain the worker across renders and careful effect handling; Svelte's `onMount` and ordinary variables feel closer to plain JavaScript. React's JSX feels more familiar to the author, while Svelte's templates, reactive `$:` statements, named slots, built-in conditional classes and event modifiers have conveniences they prefer. Svelte also provides scoped styling support and detects unused CSS. The author's preference for Svelte comes mainly from less `useEffect` boilerplate and easier component navigation, while acknowledging React's strengths and keeping projects in both.

### Source excerpt

Last year I created Pomodone, a small time tracking application based on the Pomodoro technique of working in 25 minute intervals. It's a pretty basic app; it has a 25 minute timer (that runs in a Web Worker) and saves a history of your "poms" to a small Firebase database. I initially built it using React (well, Preact actually) but I then started to play around with Svelte, and decided rebuilding the app in Svelte might be a nice way to blog about the similarities and differences between the libraries. This is not a post declaring Svelte to be better than React, or vice-versa. This is a post where I'll tell you about my preferences, and what I find easier or harder with either framework. I'm not here to pick a fight! Plus, Pomodone is hardily a vastly complex application that could be used to fully put React or Svelte through its paces. Think of this post as a commentary based on my experience throwing a side project together, focusing on the developer experience putting these components together. Authentication The app uses Firebase Authentication to log a user in via either their GitHub or Google account. I love Firebase Authentication, it's such an easy way to add auth to side projects. React's hooks are a great way to package this up; I create a useCurrentUser hook which listens out to authentication changes and sets some state accordingly. I can then trust React to re-render as required when an authentication change is noted. export const useCurrentUser = () => { const [currentUser, setCurrentUser] = useState(undefined) useEffect(() => { return firebase.auth().onAuthStateChanged((details) => { setCurrentUser( details ? { displayName: details.displayName, provider: { 'google.com': 'Google', 'github.com': 'GitHub', }[details.providerData[0].providerId], uid: details.uid, } : null ) }) }, []) return [currentUser] } Within any component, I can write: const [currentUser] = useCurrentUser() This is nice; it's low effort and lets any component quickly access the curr

## VSCode Productivity: Navigating files with Breadcrumbs

DevFeed: [VSCode Productivity: Navigating files with Breadcrumbs](<https://devfeed.tech/articles/vscode-productivity-navigating-files-with-breadcrumbs-52589.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/vscode-productivity-navigating-with-breadcrumbs/>)

Published: 2021-01-31T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>)

Tags: [breadcrumbs](<https://devfeed.tech/tags/breadcrumbs.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [directory](<https://devfeed.tech/tags/directory.md>), [files](<https://devfeed.tech/tags/files.md>), [keyboard](<https://devfeed.tech/tags/keyboard.md>), [productivity](<https://devfeed.tech/tags/productivity.md>), [vscode](<https://devfeed.tech/tags/vscode.md>), [workflow](<https://devfeed.tech/tags/workflow.md>)

### AI overview

The author says VSCode Breadcrumbs, a keyboard shortcut, and a bit of configuration make jumping between files in the same directory more efficient. The excerpt does not specify the shortcut or configuration, and frames this as part of a video series on the author's VSCode workflow.

### Source excerpt

Over the next few weeks I'm going to be sharing some videos demonstrating parts of my workflow in VSCode - from managing changes with git (today's video), to reviewing pull requests, to running tests, and so on. Today I want to share how I use the VSCode Breadcrumbs with a handy keyboard shortcut and a bit of configuration to make jumping between files in the same directory really efficient: You can also watch this video directly on Youtube. If you've got any questions, comments, feedback, or just want to say hello, get in touch with me on Twitter.

## Remapping Keys on Windows 10 with Power Toys

DevFeed: [Remapping Keys on Windows 10 with Power Toys](<https://devfeed.tech/articles/remapping-keys-on-windows-10-with-power-toys-52551.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/remapping-keyboard-keys-windows-10-power-toys/>)

Published: 2020-12-27T00:00:00Z

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Microsoft PowerToys](<https://devfeed.tech/topics/powertoys.md>), [Windows](<https://devfeed.tech/topics/windows.md>), [Tool](<https://devfeed.tech/topics/tool.md>), [Vim](<https://devfeed.tech/topics/vim.md>)

Tags: [define](<https://devfeed.tech/tags/define.md>), [esc](<https://devfeed.tech/tags/esc.md>), [free](<https://devfeed.tech/tags/free.md>), [install](<https://devfeed.tech/tags/install.md>), [keyboard](<https://devfeed.tech/tags/keyboard.md>), [keys](<https://devfeed.tech/tags/keys.md>), [launcher](<https://devfeed.tech/tags/launcher.md>), [layout](<https://devfeed.tech/tags/layout.md>), [learning](<https://devfeed.tech/tags/learning.md>), [list](<https://devfeed.tech/tags/list.md>), [manager](<https://devfeed.tech/tags/manager.md>), [memory](<https://devfeed.tech/tags/memory.md>), [multiple](<https://devfeed.tech/tags/multiple.md>), [power](<https://devfeed.tech/tags/power.md>), [tool](<https://devfeed.tech/tags/tool.md>), [tools](<https://devfeed.tech/tags/tools.md>), [toys](<https://devfeed.tech/tags/toys.md>), [windows](<https://devfeed.tech/tags/windows.md>), [windows-10](<https://devfeed.tech/tags/windows-10.md>), [with](<https://devfeed.tech/tags/with.md>)

### AI overview

PowerToys' Keyboard Manager lets Windows 10 users remap a key by pressing the source key and then its replacement; the author used it to map Caps Lock to Esc. It displays configured mappings and makes them easy to remove or change. The author found this more convenient and flexible for multiple mappings than uncap, which they described as manual and limited. The text also mentions other PowerToys utilities, including a window layout manager and a Spotlight-like launcher.

### Source excerpt

Since moving to Windows 10 something I've always struggled with is how to remap keys on a keyboard. I don't remap much, but one remapping that I've used now for about ten years is that I remap Caps Lock to ESC. This started when I was learning Vim, and has become so commited to muscle memory that I can't go back from it and I'm rendered useless on any machine that doesn't have this mapped! On Mac OS this remapping was easy; the keyboard settings lets you remap certain keys, and tools like Karabiner Elements offered far more control. On Windows however, I could never find a solution. I used uncap and that did the job, but it was a bit manual, and only (by design) offered limited functionality. I really wanted a tool I could install, configure and forget about, that also gave me the ability to remap multiple keys should I need. Power Toys I then discovered Power Toys, a free set of programs for Windows 10 "power users" that provide a bunch of additional functionality. I'm surprised some of these aren't built into Windows by default (maybe one day they will), but one of the utilities that Power Toys provided is Keyboard Manager. Keyboard Manager lets you define mappings intuitively; you hit the key you want to remap, then press the key ou want to remap it to. In my case, I hit Caps Lock, then ESC, and it was done! It also provides a visible list of mappings, and makes it easy to remove them if you make a mistake or change your mind. I highly recommend checking out Power Toys, it has much to offer including a Window layout manager and a OS X Spotlight-esque launcher. I'll definitely be exploring these further!

## Software Development on Windows 10 with WSL2

DevFeed: [Software Development on Windows 10 with WSL2](<https://devfeed.tech/articles/software-development-on-windows-10-with-wsl2-52557.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/software-javascript-development-windows-10-wsl/>)

Published: 2020-12-20T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Windows Subsystem for Linux](<https://devfeed.tech/topics/wsl.md>), [software-development](<https://devfeed.tech/topics/software-development.md>), [developer setup](<https://devfeed.tech/topics/developer-setup.md>), [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>), [Windows](<https://devfeed.tech/topics/windows.md>)

Tags: [dependencies](<https://devfeed.tech/tags/dependencies.md>), [development](<https://devfeed.tech/tags/development.md>), [docker](<https://devfeed.tech/tags/docker.md>), [environment](<https://devfeed.tech/tags/environment.md>), [git](<https://devfeed.tech/tags/git.md>), [integration](<https://devfeed.tech/tags/integration.md>), [io](<https://devfeed.tech/tags/io.md>), [laptop](<https://devfeed.tech/tags/laptop.md>), [linux](<https://devfeed.tech/tags/linux.md>), [macbook](<https://devfeed.tech/tags/macbook.md>), [microsoft](<https://devfeed.tech/tags/microsoft.md>), [npm](<https://devfeed.tech/tags/npm.md>), [performance](<https://devfeed.tech/tags/performance.md>), [plugin](<https://devfeed.tech/tags/plugin.md>), [remote](<https://devfeed.tech/tags/remote.md>), [software](<https://devfeed.tech/tags/software.md>), [software-development](<https://devfeed.tech/tags/software-development.md>), [windows](<https://devfeed.tech/tags/windows.md>), [windows-10](<https://devfeed.tech/tags/windows-10.md>), [wsl2](<https://devfeed.tech/tags/wsl2.md>)

### AI overview

The author found Windows 10 productive for development using VSCode's WSL Remote integration, but WSL 1 had slow file operations during large npm installs, limited app support such as Docker, and occasional VSCode lag. WSL 2 felt faster in daily use; Microsoft's documentation cited 2-5x faster file I/O for tools such as git and npm, though the author did not benchmark it. WSL 2 also enabled Docker, and upgrading an existing WSL 1 install was described as smooth. The setup account covers updating Windows, installing WSL 2 and Ubuntu by enabling WSL, upgrading, installing a kernel update, setting WSL 2 as default, and installing the distro; the author notes this involved several steps and restarts. They then configured Windows Terminal to launch Ubuntu and installed VSCode with settings sync. Inside Ubuntu, their personal toolkit included Fish and Fisher, asdf, Node, GitHub CLI, dotfiles, and an SSH key. Windows Terminal was still rough around settings, which required JSON configuration.

### Source excerpt

Back in October 2019 I'd taken the plunge and tried Windows for my development work. It was largely a succesful experiment. By using the Windows Subsystem for Linux (WSL), I was able to run most of my tools effectively in Linux, something I'm familiar with, and with VSCode's WSL Remote plugin, I could run VSCode in Windows connected to the Linux environment provided by WSL, and things felt very familiar. Shortcomings of WSL That said, there were some minor issues and frustrations with WSL and this workflow. The main one was that WSL 1 was known to be much slower at file reads and writes. You might think this isn't a huge deal - but if you're running a package manager like npm and installing a bunch of dependencies, those reads and writes add up to the point where it's noticably slow (and I'm running on a fairly beefy XPS laptop). WSL 1 also had some holes in terms of application support, you couldn't use Docker - not something I do regularly, but something that's useful to be able to reach for - and at times I found the VSCode WSL integration to be slightly laggy. Not much, and not often, but everything wasn't quite as smooth as it would be on the MacBook I usually worked on. Enter WSL 2 WSL 2 (see an intro video here) promised major improvements over WSL 1. I can't go into the details of the implementation, because frankly it's way over my head, but from the learnings of the successes and failures of WSl 1 Microsoft were able to make amazing improvements in WSL 2. This comparsion on the MS site shows all the differences, but the highlight for me was that file IO performance was drastically improved - the docs quote 2-5x faster for running tools such as git or npm. I haven't benchmarked, but running WSL 2 feels so much snappier and I don't feel a noticable delay when running a large npm install. Additionally, WSL 2's architectural changes enable it to run many, many more apps, so using tools like Docker is now possible. And, you could upgrade a WSL 1 install to WSL

## Writing good comments: the why, not the how

DevFeed: [Writing good comments: the why, not the how](<https://devfeed.tech/articles/writing-good-comments-the-why-not-the-how-52452.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/code-comments-why-not-how/>)

Published: 2020-07-28T00:00:00Z

Content type: opinion

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [code comments](<https://devfeed.tech/topics/code-comments.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [legacy systems](<https://devfeed.tech/topics/legacy-systems.md>)

Tags: [advice](<https://devfeed.tech/tags/advice.md>), [code](<https://devfeed.tech/tags/code.md>), [code-comments](<https://devfeed.tech/tags/code-comments.md>), [developers](<https://devfeed.tech/tags/developers.md>), [writing](<https://devfeed.tech/tags/writing.md>)

### AI overview

Comments that narrate what each line does add little when the code already shows it. The useful comments explain why code takes an unusual form: they supply missing context, such as a bug workaround, legacy constraint, or business edge case, and may document the problem, examples, and intended long-term fix. The article illustrates this with React code: a comment explains a temporary handling of spread `key` props, why the current logic cannot distinguish an explicitly undefined key, and the plan to deprecate key spreading. The author argues that code can be traced to learn what it does, while the reason for a decision is harder to recover later.

### Source excerpt

Code comments often get a bad reputation amongst developers as a waste of time, or a sign that your code could be improved. Here's a quote from a CONTRIBUTING.md file I found on GitHub (and there's many, many more like it): Comments should be avoided. If the code cannot be understood without comments, re-write the code to make it self-explanatory. I think this is pretty poor, incorrect advice the vast majority of the time. I think this stems back to most people's experience learning code. I have a strong memory of a lecturer in my first term of my Computer Science degree (although you'll find this advice in many courses, regardless of if it's University or not) telling us: Every line of code should have a comment explaining what it does. Your upcoming coursework will be marked on this criteria. So, if you're a new student fresh into the course, what do you do? You comment your code of course! // set the input value from the ENV value bar const inputValue = process.ENV.bar // now multiply it by 2 const newValue = inputValue * 2 // now pass it to the square function const finalValue = square(newValue) // this function squares a number and returns the new number const square = (x) => x * x The people who say that comments are bad are thinking of this style of commenting, and they'd be absolutely right! Comments like this that describe the "how" of programming add absolutely no value. Each of those comments above added nothing that couldn't be understood from the code immediately below it. Comment the why The problem with the comments above is that they comment the how. They describe the steps we take. Those comments are very rarely useful; code does a good job at explaining how we do something. After all, lines of code are instructions to tell the computer how to do something. Most of the time you'll find that you don't need to leave a myriad of comments because you can write the code you want to and you don't hit any oddities or quirks that cause the code to look unus

## Testing event listeners in JavaScript

DevFeed: [Testing event listeners in JavaScript](<https://devfeed.tech/articles/testing-event-listeners-in-javascript-52564.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/testing-event-listeners-javascript/>)

Published: 2020-07-14T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Unit testing](<https://devfeed.tech/topics/unit-testing.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Publish-subscribe pattern](<https://devfeed.tech/topics/pubsub.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [event](<https://devfeed.tech/tags/event.md>), [event-listeners](<https://devfeed.tech/tags/event-listeners.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

A test can pass without checking an event if its only assertion sits inside a listener callback that never runs. The excerpt recommends deliberately making each new test fail once, then offers two Jest fixes: `expect.assertions(1)` catches a missing assertion, while a `jest.fn()` spy lets the test assert that the handler ran once and received the expected data. The spy approach produces a more specific failure message. The final example follows arrange, act, assert: set up the page and spy, register the handler and make the request, then assert call count and arguments. SinonJS is suggested for spies when not using Jest.

### Source excerpt

Testing JavaScript code that's asynchronous can prevent its own set of challenges that you have to ensure you deal with when writing your tests. I recently came across a test that fell foul to the asynchronous code it was trying to test and in this post I'll show you how to look out for these tests and how to fix it. The problem Let's imagine we're working on an API that lets you make requests to load pages in a web browser. We have a Page class that provides the makeRequest method that will emit a request_started event: const EventEmitter = require('events') class Page extends EventEmitter { makeRequest(url) { this.emit('request_started', { url }) } } This means any other part of this codebase can listen out for these events: page.on('request_started', () => { /* do something here */ }) This is useful functionality, so let's write a test for it: describe('Page class', () => { it('emits an event when a request is started', () => { const page = new Page() page.on('request_started', (data) => { expect(data.url).toEqual('www.foo.com') }) page.makeRequest('www.foo.com') }) }) This test passes, but it's hiding a problem. What happens if we deliberately break it? If we remove the this.emit line, look what the test outputs: PASS src/site/code-for-posts/async-tests/async-tests.test.js Page class ✓ emits an event when a request is started (6 ms) This is less good 😒. But why does it pass? If we take a look at the test body, think about what happens when the request_started event never fires. Which of the lines below will end up being executed? it('emits an event when a request is started', () => { const page = new Page() page.on('request_started', (data) => { expect(data.url).toEqual('www.foo.com') }) page.makeRequest('www.foo.com') }) Because our expect call is within the event listener callback, it never runs if the event never fires! This is problematic because most test frameworks assume a test that doesn't explicitly fail is passing. Most test frameworks won't notify you

## Better code reviews

DevFeed: [Better code reviews](<https://devfeed.tech/articles/better-code-reviews-52490.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/how-to-do-good-code-reviews/>)

Published: 2020-07-09T00:00:00Z

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Code review](<https://devfeed.tech/topics/code-review.md>), [Pull Request](<https://devfeed.tech/topics/pull-request.md>), [Prettier](<https://devfeed.tech/topics/prettier.md>), [code comments](<https://devfeed.tech/topics/code-comments.md>), [Static code analysis](<https://devfeed.tech/topics/static-code-analysis.md>)

Tags: [automate](<https://devfeed.tech/tags/automate.md>), [code-review](<https://devfeed.tech/tags/code-review.md>), [code-reviews](<https://devfeed.tech/tags/code-reviews.md>), [comment](<https://devfeed.tech/tags/comment.md>), [context](<https://devfeed.tech/tags/context.md>), [culture](<https://devfeed.tech/tags/culture.md>), [eslint](<https://devfeed.tech/tags/eslint.md>), [feedback](<https://devfeed.tech/tags/feedback.md>), [formatting](<https://devfeed.tech/tags/formatting.md>), [knowledge-sharing](<https://devfeed.tech/tags/knowledge-sharing.md>), [team](<https://devfeed.tech/tags/team.md>)

### AI overview

The article recommends automating style and formatting checks with tools such as ESLint and Prettier so review time can focus on the code itself. Authors can add comments or links explaining unusual logic, while reviewers should assume missing context may explain a choice and ask for clarification. Review comments should distinguish optional suggestions from changes considered necessary before merging, helping authors prioritize feedback and supporting a safer, more collaborative review process.

### Source excerpt

When you get a code review request from a colleague, what do you focus on? What reaches the bar for what you consider something that's worth commenting on? And do you make it clear when you're making a comment on something vs considering something so important to change that the code review shouldn't be merged without it? Code review is hard. I've seen people do it really well and people do it really badly, but most of us are somewhere in the middle. Giving feedback to people is hard, and it takes practice to be comfortable taking feedback on that large piece of code you've spent the last couple of days thinking about. Code reviews are so crucial to a team's pace, but also their happiness. I've seen bad code reviews become almost infamous and hurt a team's culture because people start to feel unsafe sharing their code for review. A good code review process gets you better code in the codebase whilst at the same time boding your team, increasing knowledge sharing and providing a great opportunity for team members to learn from each other. With that in mind, here's some things I've learned that have helped me improve code review - both reviews that I get from others, and reviews I give others: Automate as much of code review as you can. Code review isn't for comments on syntax, or the use of single quotes over double quotes, or for spotting variables that aren't used. Use ESLint or other such tools rigorously to enforce your team's coding styles, and reach for a code formatter like Prettier that auto-formats code to a style. Not everyone may not love every formatting choice, but that doesn't matter. Time spent arguing the amount of spaces to indent is not worth it. As the creator of the code, leave comments or links to context where it makes sense. We've all made a change that has a piece of code that seems odd on first glance. Maybe you have to implement some really odd logic that doesn't make sense until you really dig in, or you had to work around a browser bug and

## How code gets bad

DevFeed: [How code gets bad](<https://devfeed.tech/articles/how-code-gets-bad-52489.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/how-javascript-code-gets-bad/>)

Published: 2020-07-07T00:00:00Z

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [application](<https://devfeed.tech/tags/application.md>), [attention](<https://devfeed.tech/tags/attention.md>), [big-bang](<https://devfeed.tech/tags/big-bang.md>), [bugs](<https://devfeed.tech/tags/bugs.md>), [business](<https://devfeed.tech/tags/business.md>), [code](<https://devfeed.tech/tags/code.md>), [code-quality](<https://devfeed.tech/tags/code-quality.md>), [confidence](<https://devfeed.tech/tags/confidence.md>), [dependency](<https://devfeed.tech/tags/dependency.md>), [deploy](<https://devfeed.tech/tags/deploy.md>), [developer](<https://devfeed.tech/tags/developer.md>), [developers](<https://devfeed.tech/tags/developers.md>), [feature](<https://devfeed.tech/tags/feature.md>), [features](<https://devfeed.tech/tags/features.md>), [hack](<https://devfeed.tech/tags/hack.md>), [hacked](<https://devfeed.tech/tags/hacked.md>), [knowledge](<https://devfeed.tech/tags/knowledge.md>), [new-feature](<https://devfeed.tech/tags/new-feature.md>), [rewrite](<https://devfeed.tech/tags/rewrite.md>)

### AI overview

Code corners become hard to change safely when knowledge or confidence is lost--for example, after a developer leaves, a rushed rewrite, or an unmaintained dependency. Under limited time, later developers may hack in changes and defer cleanup; those shortcuts can accumulate, making the area harder to understand and extend. The author acknowledges that deadline-driven compromises can be necessary, but argues that big-bang rewrites are costly, risky, and delay value until release. The proposed approach is to improve the system incrementally through small changes across deployments, aiming to reduce risk while keeping it in use.

### Source excerpt

We've all been there. The one corner (or maybe there's multiple!) of your application that makes you cringe every time you have to touch that part of the code. The proposed feature that you hope doesn't make it into the prioritised list of work because implementing it means diving deep into the guts of the nasty corner of your codebase that is hard if not impossible to work on with confidence. At one company I worked at I had a very frustrated product manager exclaim "Jack, it feels like whenever I propose a new feature on [site area X], you tell me it can't be done". The unfortunate truth was that it couldn't; that area of the site functioned just fine but no one could tell you how or work on it confidently without causing other bugs. The problem with areas of the site like this is that they only get worse once they start deteriorating into what I like to call "quick hack territory" which normally goes something like this: An event happens that causes knowledge and confidence of a feature to be lost; this could be the developer who built it moving on, a huge quick rewrite to meet a rushed deadline, or a 3rd party dependency becoming unmaintained. The next developer who has to work on that part of the codebase doesn't have a solid knowledge, or they are up against a tight deadline, so they rush and "hack" their change into place. They mean to come back to it later - as we all do - but other work gets in the way. The next person who touches this area sees the previous person hacked their way to success and either: decides this code is in need of some attention to get it back to a satisfactory standard decides that time pressures are too great and they hack their feature in too Rinse and repeat - but every time you don't give the code the attention it needs, you're making it worse. I want to be very clear: I'm not criticising any of the hypothetical developers above who made that decision to get their feature out no matter the cost. We have all been there, whether the

## VSCode Productivity: The rewrap plugin

DevFeed: [VSCode Productivity: The rewrap plugin](<https://devfeed.tech/articles/vscode-productivity-the-rewrap-plugin-52590.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/vscode-productivity-rewrap-plugin/>)

Published: 2020-07-02T00:00:00Z

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>), [Tool](<https://devfeed.tech/topics/tool.md>)

Tags: [code-comments](<https://devfeed.tech/tags/code-comments.md>), [commits](<https://devfeed.tech/tags/commits.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [git](<https://devfeed.tech/tags/git.md>), [markdown](<https://devfeed.tech/tags/markdown.md>), [markdown-files](<https://devfeed.tech/tags/markdown-files.md>), [plugin](<https://devfeed.tech/tags/plugin.md>), [productivity](<https://devfeed.tech/tags/productivity.md>), [vscode](<https://devfeed.tech/tags/vscode.md>)

### AI overview

The VSCode rewrap plugin wraps code comments, Git commits, and Markdown to a chosen line length. The author says they use it regularly when writing documentation in code.

### Source excerpt

Over the next few weeks I'm going to be sharing some videos demonstrating parts of my workflow in VSCode - from managing changes with git (today's video), to reviewing pull requests, to running tests, and so on. Today I want to share the rewrap plugin for VSCode. It's a fantastic tool for easily wrapping code comments, Git commits, or Markdown files to a certain line length and I use it all the time when writing documentation in code. You can also watch this video directly on Youtube. If you've got any questions, comments, feedback, or just want to say hello, get in touch with me on Twitter.

[Next page](<https://devfeed.tech/sources/jack-franklin.md?cursor=WyIyMDIwLTA3LTAyVDAwOjAwOjAwKzAwOjAwIiwgIjc5YjM0ODIzLTM3MDgtNDQ0Mi05NGRkLTBmMmE1M2RkNjc3YyJd>)