README
@codemirror/lang-javascript
[ WEBSITE | ISSUES | FORUM | CHANGELOG ]
This package implements JavaScript language support for the CodeMirror code editor.
The project page has more information, a number of examples and the documentation.
This code is released under an MIT license.
We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.
API Reference
-
javascript(config?: {jsx?: boolean, typescript?: boolean} = {}) → LanguageSupport
JavaScript support. Includes snippet completion.
-
javascriptLanguage: LezerLanguage
A language provider based on the Lezer JavaScript parser, extended with highlighting and indentation information.
-
typescriptLanguage: LezerLanguage
A language provider for TypeScript.
-
jsxLanguage: LezerLanguage
Language provider for JSX.
-
tsxLanguage: LezerLanguage
Language provider for JSX + TypeScript.
-
snippets: readonly Completion[]
A collection of JavaScript-related snippets.
-
esLint(eslint: any, config?: any) → fn(view: EditorView) → Diagnostic[]
Connects an ESLint linter to CodeMirror's lint integration.
eslint
should be an instance of theLinter
class, andconfig
an optional ESLint configuration. The return value of this function can be passed tolinter
to create a JavaScript linting extension.Note that ESLint targets node, and is tricky to run in the browser. The eslint4b and eslint4b-prebuilt packages may help with that.