@peggyjs/eslint-parser
TypeScript icon, indicating that this package has built-in type declarations

2.0.6 • Public • Published

Eslint-style parser for Peggy grammars

For linting Peggy grammars using eslint.

Install

npm install -D @peggyjs/eslint-parser

API

We'll document this more if anyone else wants to use it.

import { parseForESLint, visitor } from "@peggyjs/eslint-parser";

const parserResults = parseForESLint(text, { filePath: filename });
const v = new visitor.Visitor({
  rule(node) {
    console.log(node.name.value);
  }
});
v.visit(parserResults.ast);

Notes

This uses a slightly different grammar than the one built in to Peggy, in order to pull out information about more concrete parts of the grammar like punctuation that don't matter to Peggy semantics.

Tests codecov

/@peggyjs/eslint-parser/

    Package Sidebar

    Install

    npm i @peggyjs/eslint-parser

    Weekly Downloads

    57

    Version

    2.0.6

    License

    MIT

    Unpacked Size

    211 kB

    Total Files

    11

    Last publish

    Collaborators

    • charlespick
    • hildjj