TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

Fix update core dependencies

Open MattiasBuelens opened this issue 1 year ago • 9 comments

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: [email protected]
npm ERR! Found: [email protected]
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/[email protected]
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/[email protected]
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/'

MattiasBuelens avatar Apr 28 '24 09:04 MattiasBuelens

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 avatar Apr 28 '24 09:04 saschanaz

We can also try 8.0.0-alpha.3 🤔

saschanaz avatar Apr 28 '24 09:04 saschanaz

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 avatar Apr 28 '24 12:04 MattiasBuelens

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 avatar Apr 28 '24 13:04 MattiasBuelens

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.

MattiasBuelens avatar Apr 28 '24 13:04 MattiasBuelens

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.)

saschanaz avatar Apr 28 '24 13:04 saschanaz

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

sandersn avatar May 08 '24 19:05 sandersn

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

saschanaz avatar May 08 '24 20:05 saschanaz

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

MattiasBuelens avatar May 08 '24 20:05 MattiasBuelens

Looks like the dependency tree is now good per #1768, I think we can rebase this and we should be good to go.

saschanaz avatar Aug 01 '24 20:08 saschanaz

I updated the eslint config and then to eslint@9 and ts-eslint@8.

sandersn avatar Aug 13 '24 13:08 sandersn

That auto migration unnecessarily added FlatCompat, would be nice to rebase this and remove that.

saschanaz avatar Aug 21 '24 18:08 saschanaz

Closing this PR in favor for #1784, which focuses on just the ESLint flat config migration.

MattiasBuelens avatar Aug 22 '24 18:08 MattiasBuelens