asm.js-lint
raw JSON → 0.1.3 verified Fri May 01 auth: no javascript deprecated
asm.js-lint is a linting plugin for CodeMirror that validates asm.js code. Version 0.1.3, released around 2013, is the latest stable release. The package is minimal and designed to be used alongside CodeMirror's existing lint addon. It provides a helper script for validation and requires browserification for development. This plugin is rarely updated and has limited adoption, serving as a niche tool for asm.js development within CodeMirror.
Common errors
error Cannot find module 'asm.js' ↓
cause Development build requires asm.js to be installed globally or locally.
fix
Run 'npm install asm.js' before browserifying.
error Uncaught TypeError: Cannot read property 'asm' of undefined ↓
cause CodeMirror's lint addon has not been loaded before asm-lint.js.
fix
Ensure the script tag for 'addon/lint/lint.js' is included before asm-lint.js.
error asm-lint.js requires a CodeMirror instance ↓
cause asm-lint.js expects CodeMirror to be globally available.
fix
Load CodeMirror as a script tag before asm-lint.js.
Warnings
deprecated Project is no longer maintained. Use it at your own risk. ↓
fix Consider using a modern linting tool for JavaScript asm.js modules.
gotcha The package does not list CodeMirror as a peer dependency, leading to potential version mismatches. ↓
fix Ensure you manually install a compatible version of CodeMirror.
gotcha The library requires browserify for development builds, which may not be obvious. ↓
fix Run 'browserify src/asm-lint-helper.js -o dist/asm-lint-helper.compiled.js' after installing asm.js.
gotcha The plugin only works in browser environments; Node.js usage is unsupported. ↓
fix Use only in browser-based CodeMirror instances.
Install
npm install asm.js-lint yarn add asm.js-lint pnpm add asm.js-lint Imports
- asm-lint wrong
Using npm package without proper script loadingcorrectInclude script tag: <script src="<path-to>/asm.js-lint/lib/asm-lint.js"></script> - asm-lint-helper wrong
Requiring via Node.js require()correctInclude script tag: <script src="<path-to>/asm.js-lint/dist/asm-lint-helper.compiled.js"></script> - CodeMirror.asmLint wrong
Using 'asm' as a mode without enabling lintcorrectUse the 'asm' lint option: CodeMirror.fromTextArea(element, { mode: 'asm', lint: true })
Quickstart
// Ensure you have CodeMirror and its lint addon included.
// Then add script tags:
// <script src="path/to/codemirror.js"></script>
// <script src="path/to/addon/lint/lint.js"></script>
// <script src="path/to/asm.js-lint/lib/asm-lint.js"></script>
// <script src="path/to/asm.js-lint/dist/asm-lint-helper.compiled.js"></script>
//
// Initialize CodeMirror with asm linting:
var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
mode: 'asm',
lint: true
});