I’m using CodeMirror 6 with Angular 14.
I’d like to turn off some parsing errors I get with this linter.
This is my code:
// other import...
import { basicSetup } from 'codemirror';
import { javascript, esLint } from '@codemirror/lang-javascript';
import { EditorState } from '@codemirror/state';
import { EditorView, keymap } from '@codemirror/view';
import { indentWithTab, redo, undo } from '@codemirror/commands';
import { linter, lintGutter } from '@codemirror/lint';
import * as eslint from "eslint-linter-browserify";
@ViewChild('textEditor', { static: false }) textEditor: any;
editorView: EditorView;
val: string = '';
// constructor, other functions...
initCodeMirror() {
let editorElement = this.textEditor.nativeElement;
let context = this;
textMode = javascript();
const config = {
parserOptions: {
ecmaVersion: 6,
}
let exts = [basicSetup, keymap.of([indentWithTab])];
exts.push(lintGutter(), linter(esLint(new eslint.Linter(), config)));
let state: EditorState = EditorState.create({
doc: this.val,
extensions: exts
});
this.editorView = new EditorView({
state,
parent: editorElement
});
this.editorView.focus();
}
I found this example but here it explains how to create a completely custom linter and that’s not what I want.
I would like to know if there is a way to create a custom linter starting from a set of rules defined in a standard linter (like the one I’m using).