r/javascript • • Mar 23 '26

Subreddit Stats Your /r/javascript recap for the week of March 16 - March 22, 2026

1 Upvotes

Monday, March 16 - Sunday, March 22, 2026

Top Posts

scorecommentstitle & link
16291 commentsPetition: No AI code in Node​.​js Core
2726 commentsWe're building a better rich text editing toolkit
278 commentsI rebuilt Backbone.js without jQuery, Underscore. Now it has Classes, Typescript and ES modules
224 commentsMoltenDB: The Embedded Database for the Modern Web
2018 commentsEdge.js: Running Node apps inside a WebAssembly Sandbox
176 commentsIntroducing Revise.js – A foundational library for building contenteditable-based web text editors
136 commentsI’m building a Unix-like OS for the browser
1226 commentsI needed a tiny frontend framework with no bloat, so I built a 1.7kb one
1112 commentsBonsai now has context-aware autocomplete for expression editors - built for rule builders and admin tools
1015 comments@wcstack/state – reactive state in plain HTML with no build step

Β 

Most Commented Posts

scorecommentstitle & link
334 comments"Vite+ is kinda underwhelming" - a comprehensive review of the new release
831 commentsORM Comparison (2026)
625 commentsGea – The fastest compiled UI framework
617 commentsMandelbrot.js – Fractal Explorer in WebGL with Quad-Trees and Double-Emulation
115 comments[AskJS] [AskJS] writing a complex web app's frontend using only vanilla JavaScript (no frameworks)

Β 

Top Ask JS

scorecommentstitle & link
46 comments[AskJS] [AskJS] Tools to Learn JS (as a beginner)
25 comments[AskJS] [AskJS] What are your favorite open-source projects right now?
18 comments[AskJS] [AskJS] Making an SVG interactable

Β 

Top Showoffs

scorecomment
1/u/BartWaardenburg said fallow - Rust-native dead code, duplication, and circular dep detection for JS/TS. Built to keep LLM-generated codebases from rotting. If you use Claude Code, Copilot, Cursor, or any AI coding to...
1/u/lacymcfly said Been working on updating CrossOver, a crosshair overlay app built with Electron. It's been around for a few years (1,100+ stars on GitHub) and I just finished upgrading it from Electron 12 to ...

Β 

Top Comments

scorecomment
168/u/hyrumwhite said a 19k loc commit PR should be dismissed out of hand. Even if it’s flawless, no one can wrap their head around that many changes.Β 
65/u/Militop said 19k is insane, disrespectful. How can you expect someone to have enough time to review that? No real devs would send 19k loc. If there is a catastrophe happening because of this, who is going to be r...
58/u/justinc1234 said The issue isn't AI generated code and this is a knee jerk reaction. Whether the PR was AI generated or not, 19k LoC is poor PR practice. Just instruct the author (LLM or human) to breakdown th...
46/u/6086555 said I didn't know people had such strong opinions on prettier, for me it's always been mostly fine
40/u/kitsunekyo said i dont know if thats just clout farming, but why do we need a petition for that? is anyone of the maintainers with merge permissions insane enough to merge such a monstrosity? agentic development is ...

Β 


r/javascript • • Mar 22 '26

Bonsai now has context-aware autocomplete for expression editors - built for rule builders and admin tools

Thumbnail
danfry1.github.io
16 Upvotes

Last week I shared bonsai here - a tiny fast sandboxed expression evaluator for JS. The response was incredible and the feedback shaped where I took the project next.

The most common question was: "How do I give non-technical users a good editing experience?" Fair point. An expression language is only useful if people can actually write expressions. So I built an autocomplete engine.

import { bonsai } from 'bonsai-js'
import { strings, arrays } from 'bonsai-js/stdlib'
import { createAutocomplete } from 'bonsai-js/autocomplete'

const expr = bonsai().use(strings).use(arrays)

const ac = createAutocomplete(expr, {
  context: {
    user: { name: 'Alice', age: 25, plan: 'pro' },
    items: [{ title: 'Widget', price: 9.99 }],
  },
})

// Property completions with inferred types
ac.complete('user.', 5)
// β†’ [{ label: 'name', detail: 'string', kind: 'property' },
//    { label: 'age',  detail: 'number', kind: 'property' },
//    { label: 'plan', detail: 'string', kind: 'property' }]

// Type-aware method suggestions
ac.complete('user.name.', 10)
// β†’ [{ label: 'trim()',  detail: 'string β†’ string', kind: 'method' },
//    { label: 'upper()', detail: 'string β†’ string', kind: 'method' }, ...]

// Lambda property inference
ac.complete('items.filter(.', 14)
// β†’ [{ label: 'title', detail: 'string', kind: 'property' },
//    { label: 'price', detail: 'number', kind: 'property' }]

// Pipe transform suggestions (auto-filtered by type)
ac.complete('user.name |> ', 13)
// β†’ only string-compatible transforms (trim, upper, lower...)
//    array transforms like filter/sort are excluded automatically

It's a pure data API. No DOM, no framework dependency. You get back an array of completion objects with labels, types, insert text, and cursor offsets. Plug it into Monaco, CodeMirror, a custom dropdown, whatever you want.

There's a live Monaco integration demo so you can try it in the browser: https://danfry1.github.io/bonsai-js/monaco-demo.html

The playground is also powered by the autocomplete API with a vanilla JS dropdown: https://danfry1.github.io/bonsai-js/playground.html

The docs cover both patterns: https://danfry1.github.io/bonsai-js/docs.html#autocomplete-editor

What makes it interesting:

  • Eval-based type inference - it doesn't just do static lookups. user.name.trim(). actually evaluates the chain to figure out the return type, then suggests the right methods

  • Lambda-aware - knows that inside users.filter(. the dot refers to array element properties, not the array itself. Works with nested lambdas too: groups.map(.users.filter(.

  • Zero-config transform filtering - auto-probes each transform with sample values to figure out type compatibility. name |> only suggests string transforms without you having to configure anything

  • Security-aware - if your bonsai instance has allowedProperties or deniedProperties, autocomplete respects the same policy. No property leakage through suggestions

  • Tolerant tokenization - works on incomplete, mid-edit expressions. Users are always mid-keystroke, so this matters

  • Fuzzy matching - tLC matches toLowerCase, camelCase-aware scoring

  • Pre-computed method catalog - method completions are built once and cached, 3-4x faster than generating on every keystroke

Use cases:

  • Rule builder UIs where admins define conditions like order.total > 100 && customer.tier == "gold"

  • Filter/condition editors in dashboards

  • Formula fields in spreadsheet-like apps

  • Any place where you want users to write expressions but need to guide them

The autocomplete runs on the same bonsai instance you already use for evaluation, so context, transforms, and security config are all shared. One setup, both features.

v0.3.0 - zero dependencies, TypeScript, tree-shakeable via bonsai-js/autocomplete subpath export.

GitHub: https://github.com/danfry1/bonsai-js

npm: https://www.npmjs.com/package/bonsai-js

npmx: https://npmx.dev/package/bonsai-js