lang-javascript

JavaScript, TypeScript, and JSX language support for the CodeMirror 6 code editor.

Library
npm
v6.2.5
78 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
32 /100 Needs Attention
Development Activity 4
Maintenance 0
Community 44
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
85 /100 Excellent
Architecture 85
Code Quality 80
Innovation 88
Learning Curve 80

@codemirror/lang-javascript is the official language package that teaches CodeMirror 6 to understand JavaScript and its close relatives. Built on the Lezer JavaScript parser, it supplies syntax highlighting, context-aware indentation, code folding, and autocompletion for plain JS, TypeScript, JSX, and TSX from a single importable extension.

Drop the javascript() extension into an editor and you get a fully wired language mode: snippet and local-variable completion, JSX auto-closing tags, and an optional bridge to ESLint for inline diagnostics. It is a small, focused dependency that turns a bare CodeMirror instance into a capable JavaScript editing surface.

What You Get

  • A one-call javascript() extension configurable for TypeScript and JSX dialects
  • Standalone language providers: javascriptLanguage, typescriptLanguage, jsxLanguage, and tsxLanguage
  • Snippet and local-variable completion sources, plus scopeCompletionSource for completing from a live scope object
  • autoCloseTags extension that inserts matching JSX closing tags as you type
  • An esLint adapter that connects an ESLint Linter instance to CodeMirror’s lint panel

Common Use Cases

  • Adding a JavaScript or TypeScript editor to a web app, playground, or documentation site
  • Building an in-browser JSX/TSX editing experience with auto-closing tags
  • Wiring inline ESLint diagnostics into a CodeMirror-based code editor
  • Providing context-aware autocompletion for user-authored scripts or config

Under The Hood

Architecture — The core lives in src/javascript.ts, where LRLanguage.define wraps the @lezer/javascript parser and decorates it with indentNodeProp, foldNodeProp, and language-data facets (comment tokens, bracket closing, indent-on-input triggers). Dialect variants (typescriptLanguage, jsxLanguage, tsxLanguage) are produced by .configure() calls that toggle the parser dialect and attach a JSX Sublanguage via sublanguageProp. The public javascript() function in the same file composes the chosen language provider with keyword/snippet completion and, for JSX, the autoCloseTags input handler — a EditorView.inputHandler that resolves the syntax tree at the cursor to decide when to insert </tag> or </>.

Tech Stack — Written entirely in TypeScript (100% of the source) and built with @codemirror/buildhelper. It depends on the CodeMirror 6 module family (@codemirror/language, state, view, autocomplete, lint) as peer-style dependencies and on the Lezer stack (@lezer/common, @lezer/javascript) for parsing. It ships dual ESM/CJS builds with generated type declarations and is marked side-effect-free for tree-shaking.

Code Quality — The codebase is compact and cohesive: four focused source modules (javascript.ts, complete.ts, snippets.ts, eslint.ts) behind a thin index.ts re-export barrel. Tests exist under test/ (test-indent.ts, test-syntax.ts) exercising indentation and syntax behavior via CodeMirror’s test runner. Types are strict and the public surface is documented with /// doc comments that generate the README API reference.

API Design — The developer experience is excellent: the common path is a single javascript({typescript, jsx}) call, while advanced users can reach for the individually exported language providers and completion sources. Naming is consistent and self-describing, every exported symbol carries a documentation comment, and the README shows a complete working example in a few lines. Getting a JavaScript editor running requires almost no boilerplate.

Used by 47 apps in this directory

Rust
72%
Apache 2.0

Rivet

AI Agents · Developer Tools

6,326

Stateful actors as a primitive for AI agents, real-time collaboration, and durable execution — with in-memory state, WebSockets, queues, and scheduling built in.

View details
87
Repo Health
81
Technical
64
Dependency
Built with
Rust 72%
TypeScript 25%
Updated 5 days ago
TypeScript
97%
Other

Rocket.Chat

Team Chat

46,304

The secure, self-hosted team communications platform for organizations that cannot compromise on data sovereignty.

View details
96
Repo Health
79
Technical
63
Dependency
Built with
TypeScript 97%
Updated 5 days ago
Go
64%
MIT

sandboxd

Developer Tools · Devops

971

Self-hosted engine for AI app-builder products: give every user an isolated sandbox, a built-in coding agent, and a live preview URL — one command, no Kubernetes.

View details
77
Repo Health
83
Technical
68
Dependency
Built with
Go 64%
TypeScript 25%
Updated 1 weeks ago
TypeScript
99%
MIT

Sanity

CMS

6,370

Open-source headless CMS with a fully customizable React Studio, real-time collaborative editing, structured content modeling, and GROQ query language

View details
92
Repo Health
90
Technical
66
Dependency
Built with
TypeScript 99%
Updated 5 days ago
TypeScript
67%
MIT

Scalar

Developer Tools

16,313

Beautiful, interactive OpenAPI documentation with a built-in offline-first API client and multi-language code generation — all in one open-source platform.

View details
90
Repo Health
89
Technical
65
Dependency
Built with
TypeScript 67%
Vue 29%
Updated 5 days ago
TypeScript
50%
Other

SigNoz

Analytics · Monitoring

32,429

Self-host your entire observability stack — logs, metrics, traces, and LLM monitoring — in one OpenTelemetry-native platform, without the Datadog bill.

View details
92
Repo Health
83
Technical
64
Dependency
Built with
TypeScript 50%
Go 38%
Updated 6 days ago
Python
100%
Other

Sourcebot

AI Code Assistants · Developer Tools · Search

4,005

A self-hosted, AI-powered code search engine that indexes every repo across GitHub, GitLab, Bitbucket, Gitea, Gerrit, and Azure DevOps, so both engineers and coding agents can search, browse, and ask questions about your codebase from one place.

View details
86
Repo Health
83
Technical
61
Dependency
Built with
Python 100%
Updated 1 weeks ago
TypeScript
85%
Apache 2.0

superset

AI Code Assistants · AI Development

15,503

Orchestrate an army of AI coding agents—Claude Code, Codex, Gemini CLI, and more—running simultaneously in isolated git worktrees from a single Electron desktop app.

View details
86
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 85%
Updated 5 days ago
TypeScript
68%
AGPL 3.0

Tolaria

Note Taking

20,161

A free, open-source, local-first desktop app for managing markdown knowledge bases on macOS, Windows, and Linux — for second brains, company docs, or AI assistant memory and procedures.

View details
84
Repo Health
71
Technical
68
Dependency
Built with
TypeScript 68%
HTML 15%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers