Comments (12)
seems it's working as expected - as said in the node.js docs:
"default" - the generic fallback that always matches. Can be a CommonJS or ES module file. This condition should always come last.
https://nodejs.org/docs/latest/api/packages.html#conditional-exports
the next steps:
- it should report the exact error message in the rule, than just ignoring. (will be fixed by #231)
- fix
@humanwhocodes/retry
to put thedefault
to last.
from eslint-plugin-n.
maybe (I'm not a native English speaker). but it's also saying:
Within the "exports" object, key order is significant. During condition matching, earlier entries have higher priority and take precedence over later entries. The general rule is that conditions should be from most specific to least specific in object order.
generally, it should be a best practice to put it in the last.
from eslint-plugin-n.
Fair point! Notes for next time include to read the source! 😅
from eslint-plugin-n.
Agreed, I think I will do point two:
Pr enhanced resolve to allow the error to be ignored via an option
It may also be worth seeing if we can add a rule to eslint-plugin-package-json too specifically about this if there is not one already 🤔
from eslint-plugin-n.
After some looking, this is related to: #182
The error is that the exports are the wrong way around:
https://github.com/humanwhocodes/retry/blob/8f8af13/package.json#L10-L13
Therefore this error is getting triggered:
https://github.com/webpack/enhanced-resolve/blob/main/lib/util/entrypoints.js#L475
from eslint-plugin-n.
For context: Sounds like this regression is caused by #139 then
@scagood Want help to look into it?
from eslint-plugin-n.
Yeah, I would tend to agree. I am thinking about what the best course here is.
We could:
- Ignore the error (but then not have a path)
- Pr enhanced resolve to allow the error to be ignored via an option (I don't understand why it throws as opposed to just accepting the default as default)
from eslint-plugin-n.
The think that is in in the back of my head is related to this:
This condition should always come last.
I interpret this as should always be checked last, not should always appear last in the object's properties
I do know that as of es2020
property ordering is expected (eg in for-in
). But before that I don't think there was any guarantee of order 🤔
from eslint-plugin-n.
Note that the "types" condition should always come first in "exports".
Taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-7.html#packagejson-exports-imports-and-self-also supports this
from eslint-plugin-n.
I think we should then close this and proceed with #182 (My first attempt to make that more verbose is here: #231)
from eslint-plugin-n.
Well, if node.js can resolve the module and the issue this plugin finds isn’t within the project that runs the linting but rather in one of its dependencies, then I think the linting shouldn’t fail as it’s kind of a false alarm?
Such a failed linting should happen in the project that published the incorrect fields instead.
from eslint-plugin-n.
Well, if node.js can resolve the module and the issue this plugin finds isn’t within the project that runs the linting but rather in one of its dependencies, then I think the linting shouldn’t fail as it’s kind of a false alarm?
Such a failed linting should happen in the project that published the incorrect fields instead.
I agree with this. The current setup for the retry package works fine in Node.js so I don't think it should be considered a problem. This seems more like something that other tooling is trying to enforce rather than an actual problem with the package.
That said, I can update the package to swap the order of exports.
from eslint-plugin-n.
Related Issues (20)
- Bug: False-positive in `n/no-unsupported-features/node-builtins` HOT 1
- Bug: False positive for `canParse` in `n/no-unsupported-features/node-builtins`
- duplicate line with line 135 HOT 1
- Bug: `unsupported-features/node-builtins-modules` doesn't work for semver range in v17 HOT 6
- Bug: unexpected token ??= HOT 2
- Bug: no-unsupported-features/es-builtins: fetch reported unsupported despite Node.js >=18.16.0 HOT 7
- ✨ Update to node v22.0.0 HOT 1
- Bug: no-unsupported-features/es-builtins false positives HOT 1
- Bug: The 'Buffer' is still an experimental feature The configured version range is '>=18.6'. HOT 1
- New option: Support `"fetch"` in `"ignore"` option of `n/no-unsupported-features/node-builtins` HOT 3
- Bug: [`n/no-unsupported-features/node-builtins`] false-positive when writing to the variable HOT 1
- Change Request: Add option to allow `NODE_ENV` in `n/no-process-env` HOT 4
- Support for "import attributes" and "import assertions" HOT 2
- Bug: package.json import results in no-missing-import HOT 5
- Bug: import type fails with no-missing-import if node fails to resolve the import HOT 4
- Rule ideas
- Change Request: Missing issue template for "rule change"?
- New Rule: `n/no-path-concat` for `import.meta.*`
- Bug: Make disabling the no-unpublished-x rules in private packages opt-in HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-plugin-n.