microsoft / TypeScript-DOM-lib-generator

Tool for generating dom related TypeScript and JavaScript library files
Apache License 2.0
600 stars 417 forks source link

Fix update core dependencies #1708

Open MattiasBuelens opened 2 months ago

MattiasBuelens commented 2 months ago

The "update core dependencies" workflow is broken again, see log:

Run npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: typescript-dom-lib-generator@0.0.1
npm ERR! Found: eslint@9.1.1
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"^9.1.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^8.56.0" from @typescript-eslint/parser@7.7.1
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   dev @typescript-eslint/parser@"^7.7.1" from the root project
npm ERR!   peer @typescript-eslint/parser@"^7.0.0" from @typescript-eslint/eslint-plugin@7.7.1
npm ERR!   node_modules/@typescript-eslint/eslint-plugin
npm ERR!     dev @typescript-eslint/eslint-plugin@"^7.7.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

The problem is that ESLint version 9 has been released, but TypeScript ESLint doesn't support it yet. I worked around it by making ncu -u ignore eslint for now.

That said, perhaps it would be better if this workflow only updated the actual "core dependencies"? npm-check-updates accepts a filter argument, so we could do something like this instead:

ncu -u '/^@mdn/' '/^@webref/'
saschanaz commented 2 months ago

This has never been problem for this long, it has been okay for many years. I guess ESLint 9 contains a lot of huge breaking changes? And yes I think it would be better to have a separate job rather than having a temporary workaround.

(Edit: I mean, it's not "broken again", it has been broken with the same error for several weeks and I was expecting it would be solved very soon.)

saschanaz commented 2 months ago

We can also try 8.0.0-alpha.3 🤔

MattiasBuelens commented 2 months ago

ESLint 9 changed the default configuration format to the new "flat config". So we'd need to migrate to the new format, or throw ESLINT_USE_FLAT_CONFIG=false into the mix. But either way, it won't be an "automatic" upgrade, we need to make some changes.

Indeed, it looks like we'll need an alpha release of typescript-eslint for now, but I can give it a shot if you want?

MattiasBuelens commented 2 months ago

Never mind, that alpha version still only supports ESLint v8. Support for ESLint v9 is still being worked on in https://github.com/typescript-eslint/typescript-eslint/pull/9002, so we cannot update to v9 at the moment.

I'll see if I can migrate us to the flat config format already. That should hopefully make it easier to update to v9 once TypeScript ESLint adds support.

MattiasBuelens commented 2 months ago

That should do it.

The next workflow run should properly update the dependencies again:

$ ncu -u -x eslint -x @eslint/js
Upgrading TypeScript-DOM-lib-generator/package.json
[====================] 24/24 100%

 @mdn/browser-compat-data  ^5.5.21  →  ^5.5.23
 @webref/css               ^6.12.7  →  ^6.12.9
 @webref/idl               ^3.46.1  →  ^3.47.1

Run npm install to install new versions.
saschanaz commented 2 months ago

But again, should we try only updating "core dependencies" rather than doing a temporary workaround? I just opened #1709 which will let Dependabot to do things better, after that this job won't need to update other deps. (It did mostly because Dependabot had no group update, but now it has.)

sandersn commented 2 months ago

I ended up reading #1709 and #1708 out of order. Now that #1709 is merged, only the eslint config update is needed, right?

saschanaz commented 2 months ago

https://github.com/typescript-eslint/typescript-eslint/pull/9002 is still open, that should happen too.

MattiasBuelens commented 2 months ago

Yeah, I think I'll wait for TypeScript ESLint to get updated first.