Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

monaco-js-linter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monaco-js-linter

Simple JS Linter for the Monaco Editor.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-81.82%
Maintainers
1
Weekly downloads
 
Created
Source

Monaco JS Linter

Monaco JS Linter is a simple JavaScript Linter plugin for the Monaco Editor. It uses jsHint under the hood to verify JavaScript Code.

Installation

npm i monaco-js-linter

Usage

import monaco, { editor } from 'monaco-editor';
import JSMonacoLinter from 'monaco-js-linter';

// The Monaco Editor can be easily created, given an
// empty container and an options literal.
// Two members of the literal are "value" and "language".
// The editor takes the full size of its container.

const editor = monaco.editor.create(document.getElementById('container'), {
    value: 'js code here ...',
    language: 'javascript',
});

const linter = new JSMonacoLinter(editor, monaco);
linter.watch();

You can get the linter response in this way :

import { JSMonacoMarks } from 'monaco-js-linter';

//...

const jsCode = editor.getValue();
const report = new JSMonacoMarks(jsCode);
const response = report.getLinterResponse();

API

Class: JSMonacoLinter(editor: editor.IStandaloneCodeEditor, monaco: Monaco, options?: LintOptions)

Attributes
  • editor: editor.IStandaloneCodeEditor The object returned when you create an editor.
  • monaco: typeof monaco The monaco variable.
  • options?: LintOptions ESHINT options.
Methods
  • lint () => void: Lint one time the editor.
  • watch () => void: Lint the editor each time the onChange event is triggered.

Class: JSMonacoMarks(js: string, options?: LintOptions)

Attributes
  • html: string The codoe to verify.
  • options: LintOptions JSHINT options.
  • linterResponse: LintData Value returned by JSHINT.
Methods
  • getEditorMarks(monaco: Monaco): IMarkerData[] Return the monaco markers.
  • getLinterResponse(): LintData
  • lint(): LintData

License

MIT, see the LICENSE file for detail.

Keywords

FAQs

Package last updated on 10 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc