Closed dandubya closed 11 months ago
Hi there,
Personally I think the best option is to exclude autogenerated files from linting, as philosophically linting is intended for humans. (You wouldn't expect a code minimiser to respect linting for example).
However, I wonder if it would be possible for you to use the header to include a comment at the top of the file disabling the no-explicit-any
for this file?
Alternatively can you use eslint overrides in the .eslintrc.js to disable no-explicit-any for this file?
All great points. Thank you.
Using the grammar header worked brilliantly. Here's what I did, for anyone else who might encounter this.
---
/* eslint-disable @typescript-eslint/no-explicit-any */
---
tspeg --include-grammar-comment false grammar.peg parser.ts
Thanks again!
Great I'm glad to hear that the header approach worked!
Using:
The following line in the generated parser (almost at the bottom):
public record(pos: PosInfo, result: any, att: MatchAttempt) {
...causes eslint to complain about the use of
any
.A workaround is to add this right before that line:
// eslint-disable-next-line @typescript-eslint/no-explicit-any
When I'm iterating on a grammar and doing a lot of testing, I have to manually fix this every time I compile a new grammar version into a parser. It would be nice to have an option to insert this line automatically.
I could add the file to .eslintignore, but it seems safer to keep it on because I've had some deployment issues (Next/Vercel) when I've ignored linting on whole files.