Closed monkpit closed 2 years ago
Can you link to a work in progress branch so I can have a look?
@edg2s Hey, thanks for the quick reply! I actually can't since it's for work. I'll try to create a minimal repo where it can be reproduced.
@edg2s
Here you go: https://github.com/monkpit/docgen-issue-repro
From my experimenting, it seems it's triggered by having an .eslintrc.json
in my project root, that is extending another config inside node_modules
.
I added node_modules/fake-module
to demonstrate it.
Clone the repo, install the deps (which should also install deps inside of fake-module
automatically), and then do npm run docs
.
In my original repo that I was having this issue in, I tried removing the reference to extends: 'node_modules/...'
and the error from my OP goes away.
I'm not sure why eslint-docgen is even seeing my local project's .eslintrc.json
anyways? I am passing in the rule directly, it shouldn't need to check my local config for my project.
Hmm, reaching into node_modules to get an ELint config seems like undocumented behaviour. I would guess that ESLint recommends you expose the shared config properly?
You should be able to test with:
npm i --save-dev wikimedia/eslint-docgen#custom-parser
If this fixes your issue I will merge and do a minor release.
It works flawlessly! 🎉 Thanks!
I really wanted to use this package and I tried for a few days on and off to get it to work, but I keep running into this error:
@babel/eslint-parser
is used by one of the dependencies of my eslint plugin (an internal work thing) so it's reasonable that it would show up as the parser here.The path that is given in the error message is valid and leads to
@babel/eslint-parser
as expected if I try to open it (meaning it's certainly able to be found :) ).I opened up the source of
write-docs-from-tests.js
and added some more logging around the error - the full stack trace is like this:If I change RuleTester to the eslint version, like
const {RuleTester} = require('eslint');
then the tests run fine and there's no issue. But then there's no docs :) unless I write them or copy/paste rule descriptions into markdown myself... which is why I would love to be able to use this package!