-
Notifications
You must be signed in to change notification settings - Fork 4
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
exports
are not respected
#132
Comments
Thanks for the report! I'll definitely plan to support |
No worries. I'm happy to work with you to get it working if that would help. |
I currently have some manual logic for importing the eslint plugin package entry point which only handles eslint-doc-generator/lib/package-json.ts Line 27 in ed310e9
However, this issue has made me realize that there must be a simpler technique for importing a local package without having to implement all the entry point logic... |
Hmm, interesting. I know ESLint supports my setup just fine, so unless I'm doing something wrong and ESLint is just super-accepting of incorrect setups, let's look at what ESLint is doing for handling imports. I've found the exact same problem with Stylelint (I haven't filed an issue there yet; I have a Stylelint library too), so I'm sure you're not the only one asking this question. |
From reading through the documentation on handling packages in Node.js, it should be handling this "automatically" when you import a package path. Perhaps I'm missing something? |
To be clear, you're not doing anything wrong, we definitely want to handle both CJS/ESM ESLint plugins (using either Node will automatically find/load a package's entry point when importing it with But in this tool, we are not importing an ESLint plugin via its package name. Instead, we're dealing with a local package on the filesystem that might not even be published, and we just have the path to this package. So the code I linked above manually looks at package.json at that file path to find the entry point to load. So if we could find a way to automatically load a local package (which could be CJS or ESM) via its file path, that would solve the problem. Passing a path to |
A few more questions:
|
Can you also show me how your ESLint plugin/config is used? |
Replies by number:
As you can see in the "extends": ["@lessonnine/usa-tech.js/preact", "@lessonnine/usa-tech.js/browser"] or for Node.js, TypeScript, and Jest: "extends": ["@lessonnine/usa-tech.js/typescript", "@lessonnine/usa-tech.js/jest", "@lessonnine/usa-tech.js/node"] Hope that makes sense. It's meant to be a library of configs that are easy to pickup and use regardless of your use case. |
Thanks for the details. I may have more questions later as I work on a fix. |
Hi,
Thank you for creating this great tool! I found it while looking through the
eslint-plugin-unicorn
repo and stumbling upon this PR: sindresorhus/eslint-plugin-unicorn#1930I would love to use your tool for my own ESLint library, but unfortunately it does not respect the
exports
defined in my library'spackage.json
. Here is the output I see and the associatedpackage.json
exports
config:Terminal output
exports
config frompackage.json
My repo does not have an
index.js
file, and as you can see above, my root export is defined inexports
and comes from a JSON file (./lib/eslintBaseConfig.json
). ESLint has no problem consuming this library, and I plan to open source it using your tool to improve my documentation. Any help you could provide would be greatly appreciated.The text was updated successfully, but these errors were encountered: