Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin for ESLint #641

Open
brettz9 opened this issue Mar 1, 2020 · 2 comments
Open

Plugin for ESLint #641

brettz9 opened this issue Mar 1, 2020 · 2 comments

Comments

@brettz9
Copy link

brettz9 commented Mar 1, 2020

Issue type

  • Bug Report:
  • Feature Request: yes
  • Question:
  • Not an issue:

Prerequisites

  • Can you reproduce the issue?: N/A
  • Did you search the repository issues?: Yes.
  • Did you check the forums?: Can't find.
  • Did you perform a web search (google, yahoo, etc)?: Yes.

Description

It'd make pegjs development a lot more convenient if an ESLint plugin could be made with a processor so one could lint one's JavaScript both in a head block of the document (as enclosed in {...}) as well as the JavaScript returning functions attached to rules.

I realize this may be out of scope, but wanted to at least put it out there (I'm a bit too tied up myself with other work at the moment to add such a feature). Thanks!

@StoneCypher
Copy link

The way I do this is to treat the .peg as a build product output, then "compile" it from a peg suffix and a js prefix. That way, the prefix can be compiled down typescript with linting and unit testing and so on

One easy way to accomplish this without that would be to use the eslint enable and eslint disable global comments

@brettz9
Copy link
Author

brettz9 commented Mar 12, 2020

Not sure I follow completely, at least re: eslint enable/disable.

FWIW, I'm thinking now that if source maps (#93) are implemented (and it appears it may not be too hard to do with https://github.com/mozilla/source-map#sourcenode ), then a linter could easily get at the source without need for separate compile steps (which could be cumbersome I would think if adding for each inline JS snippet). (And this should help solve coverage (#633) too, as nyc can ignore the generated code which doesn't map back to the user's source files.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants