feat: add a proof-of-concept eslint plugin #106
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
How would you feel about adding some parjs specific eslint rules? I think there might be some use cases for this.
Here I have implemented a super simple rule which warns that the
.debug()method should not be included in code (not good to have it in production code as it's a development time feature).Here are some other ideas for rules:
.expects("")call to make debugging easiermany1instead ofmany(...) -> exactly(1)string("a").pipe(...).pipe(...)tostring("a").pipe(..., ...)(unnecessary pipes)There may be more ideas that I couldn't think of.
I don't have experience writing eslint rules, but it looks like this way of writing the rules is pretty basic; more powerful than regular expressions but nowhere close to understanding the code on a deep level.
It's pretty easy to "cheat" the rules by writing code in a way that doesn't trigger the rule - for example storing the
.debugmethod reference in a variable and calling it later.However, I think the rules could still be useful even though it seems they are quite naive.
The proof-of-concept rule in this PR would need some improvements, such as: