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

Closed
fubhy opened this issue Oct 31, 2023 · 8 comments · Fixed by #201
Closed

Option to skip validation for Node10 #112

fubhy opened this issue Oct 31, 2023 · 8 comments · Fixed by #201

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.

@Tobbe
Copy link

Tobbe commented Jul 13, 2024

I needed this feature too. So what I did as a workaround was to write a script that:

  1. Runs attw and tells it to output json
  2. Redirect the json output to a file
  3. Reads that file and parses it into an object
  4. Reads the reported errors and reports success if all the errors reported are just node10 errors.

You can look at the script here:
https://github.com/redwoodjs/redwood/blob/d39d278dd47697f2b065888f595d9b0e459a64c7/packages/auth/attw.ts

I wish I didn't have to write the output to a file, and then read and parse that file. But I could never get it to work just straight up reading the output of attw. It's possible that #184 is related to why I can't read the full output. (Neither can jq)

schiller-manuel added a commit to schiller-manuel/router that referenced this issue Aug 29, 2024
schiller-manuel added a commit to TanStack/router that referenced this issue Aug 29, 2024
schiller-manuel added a commit to TanStack/router that referenced this issue Aug 29, 2024
* chore: upgrade to latest config version to generate correct .d.ts files

see #2223

* chore: added arethetypeswrong (attw)

since attw will report a node10 related issue we want to ignore (see https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/NoResolution.md#true-positive-node-10-doesnt-support-packagejson-exports) and cannot (yet) be configured to skip node10 (see arethetypeswrong/arethetypeswrong.github.io#112), the `no-resolution` rule is skipped

* fix(start): correctly reference client

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
@ArielBenichou
Copy link

Is there any update on this? can we have a flag --skip node10 or something?
thanks.

jason-ha added a commit to jason-ha/arethetypeswrong that referenced this issue Sep 3, 2024
Add option to ignore resolution modes such as `Node10`.
Via config: `ignoreResolutions`
Via cli: `--ignoreResolutions`

Option to skip validation for Node10 arethetypeswrong#112
jason-ha added a commit to jason-ha/arethetypeswrong that referenced this issue Sep 20, 2024
Add option to ignore resolution modes such as `Node10`.
Via config: `ignoreResolutions`
Via cli: `--ignoreResolutions`

Option to skip validation for Node10 arethetypeswrong#112
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

Successfully merging a pull request may close this issue.

9 participants