Skip to content
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

Option to skip validation for Node10 #112

Open
fubhy opened this issue Oct 31, 2023 · 6 comments
Open

Option to skip validation for Node10 #112

fubhy opened this issue Oct 31, 2023 · 6 comments

Comments

@fubhy
Copy link

fubhy commented Oct 31, 2023

Hi. Is there an option to entirely skip validation for Node10? It's possible to run it with --ignore-rules no-resolution but unless I'm wrong that also skips that rule for the other categories, correct?

@andrewbranch
Copy link
Collaborator

andrewbranch commented Nov 6, 2023

This is more or less something I have been wanting/planning for some time, but I think I want to implement it differently from --ignore-rules. I think the results for every resolution option should always be visible, but you should be able to control the criteria for a passing/failing exit code. In addition to some kind of granular config, I was imagining that this could open up some kinds of presets/profiles, so a project could say “show me all the results, enforcing that I comply with the esm-only profile.” I can see different projects wanting to validate against at least these profiles:

  • strict / max-compat (all rules, all entrypoints, all resolution modes, like today)
  • modern (ignore node10)
  • esm-only (ignore node10 and node16-cjs)

On the CLI, you could specify what you intend to conform to, whereas on the web, it could show all profiles and whether they’re satisfied. (I know most people using this project only want to test their own code with the CLI, but I personally track trends in the results on several thousand popular packages over time, and it would be cool for me to be able to have an additional useful way to segment that data.)

@markerikson
Copy link

Yes, that would be wonderful!

Here's another slightly different scenario to toss out there.

For React-Redux, we've got a couple alternate entry points. React-Redux v8 had "react-redux/next", v9 will have "react-redux/compat". v9 is where we're adding package.exports.

I'm generating the right bundles and setup for package.exports to work, but that /compat entry point won't work under Node10 because I'm not writing a named file to disk in that location. That's intentional. But, that means I've had to disable the check entirely with --ignore-rules no-resolution. It'd be nice if I could just do it for the one entry point or something.

@benmccann
Copy link

benmccann commented Nov 14, 2023

It would be nice if it looked at the engines field in package.json. My package specifies that it only supports Node 16+ via the engines field, so it makes sense to just skip the Node 10 resolution in that case

Similarly, it would be nice to be able to skip the "node16 (from CJS)" validations since my package is ESM-only. I set "type": "module" and use the default condition to provide only ESM code (note that I use default in favor of import because the Node.js error messages are far more helpful if someone incorrectly tries to require the package).

@ari-becker
Copy link

Just to provide another data point - we have both a design library, a web frontend, and an Electron-based app. Until Electron fully supports ESM, it's stuck on moduleResolution: node, and the web frontend uses moduleResolution: bundler. I'd love to add ATTW to CI, but I'd like to skip validation for node16 and only verify that it works with node and bundler, since those are the only module resolution types we use.

@MilanKovacic
Copy link

MilanKovacic commented Nov 15, 2023

My package specifies that it only supports Node 16+ via the engines field, so it makes sense to just skip the Node 10 resolution in that case

It is possible for consumers to have typescript moduleResolution set to node10 — regardless of the Node version, in which case the types will be broken.

EDIT: Nvm, didn't read that package is ESM-only :D

unicornware added a commit to flex-development/estree-util-unassert that referenced this issue Mar 3, 2024
- arethetypeswrong/arethetypeswrong.github.io#112
- unfortunately, attw/no-resolution needs to be disabled entirely. manual review is required

Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
@jakeboone02
Copy link

jakeboone02 commented Mar 7, 2024

Has there been any development on this? @markerikson I'm having the same issue as you mentioned here: #112 (comment). I have some endpoints in package.json that won't (and shouldn't) resolve when npm pack'd. I want to use --ignore-rules no-resolution but only for specific endpoints.

Edit: FWIW, I ended up using --exclude-entrypoints to ignore certain exports altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants