Skip to content

A linter for FEEL expressions.

License

Notifications You must be signed in to change notification settings

bpmn-io/feel-lint

Repository files navigation

@bpmn-io/feel-lint

CI

Linting for FEEL expressions.

Usage

There are 2 ways to use this library:

Linting string expressions

The lintExpression function takes a string expression and returns a list of linting errors.

import { lintExpression } from "@bpmn-io/feel-lint"

lintExpression('foo = bar');

You may pass custom language configuration to the editor:

lintExpression('> 10, "yes", mike\'s name', {
  dialect: 'unaryTests',
  context: {
    "mike's name": "Mike the might"
  }
});

CodeMirror plugin

The cmFeelLinter function returns a LintSource that you can use to extend your CodeMirror instance.

import { cmFeelLinter } from "@bpmn-io/feel-lint"
import { linter } from '@codemirror/lint';

// ...

const myEditor = new EditorView({
    state: EditorState.create({
      doc: '',
      extensions: [
        linter(cmFeelLinter())
      ]
    })
  });

Hacking the Project

To get the development setup make sure to have NodeJS installed. As soon as you are set up, clone the project and execute

npm install
npm run dev

License

MIT