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

fix: add missing eslint import in generated package.json #375

Merged
merged 4 commits into from
Dec 27, 2024

Conversation

GrygrFlzr
Copy link
Member

Fixes #374
I used version @eslint/js@^9.17.0 since that's what's installed on our pnpm lockfile for this project, but maybe we can require lower?

Copy link

changeset-bot bot commented Dec 24, 2024

🦋 Changeset detected

Latest commit: 2ad8759

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
sv Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Dec 24, 2024

Open in Stackblitz

npm i https://pkg.pr.new/sveltejs/cli/sv@375
npm i https://pkg.pr.new/sveltejs/cli/svelte-migrate@375

commit: 2ad8759

@manuel3108
Copy link
Member

Mhmm, interesting. I tried reproducing exactly what you did in #374 and for me, it's not failing. This is because @eslint/js is a transitive dependency of eslint, so I cannot imagine how this case happened
image

@GrygrFlzr
Copy link
Member Author

@manuel3108 Thanks for the hint, it looks like it's specifically related to pnpm 10 (which was installed on my system) and I am indeed unable to replicate on pnpm 9. I guess I can file this as a pnpm 10 regression instead? I'll keep the issue open for now in case it's closed as works-as-intended on their end and we've been relying on undefined behavior for pnpm 9 and below.

@GrygrFlzr GrygrFlzr marked this pull request as draft December 27, 2024 08:09
@manuel3108
Copy link
Member

@GrygrFlzr Sure, sounds good!

@GrygrFlzr
Copy link
Member Author

Per #374 we really are using @eslint/js as a direct dependency, not a transitive one, and so it should be treated as such. Reopened for review.

Aside, I will also have to investigate if the prettier config generated by the CLI has similar implied dependency issues.

@manuel3108 manuel3108 merged commit dbd238b into sveltejs:main Dec 27, 2024
8 checks passed
@github-actions github-actions bot mentioned this pull request Dec 27, 2024
mikavilpas added a commit to mikavilpas/yazi.nvim that referenced this pull request Feb 9, 2025
Issue
=====

Eslint cannot be run after a clean install.

```sh
[Running: fd node_modules --no-ignore --prune -x rm -rf && pnpm i && cd integration-tests && pnpm eslint]
Scope: all 2 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +607
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 607, reused 607, downloaded 0, added 607, done

devDependencies:
+ @umbrelladocs/linkspector 0.3.13
+ markdownlint-cli2 0.17.2
+ prettier 3.4.2
+ prettier-plugin-organize-imports 4.1.0
+ prettier-plugin-packagejson 2.5.8

Done in 4.8s

> @yazi.nvim/[email protected] eslint /Users/mikavilpas/git/yazi.nvim/integration-tests
> eslint --max-warnings=0 .

Oops! Something went wrong! :(

ESLint: 9.20.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@eslint/eslintrc' imported from /Users/mikavilpas/git/yazi.nvim/integration-tests/eslint.config.mjs
Did you mean to import "@eslint/eslintrc/dist/eslintrc.cjs"?
    at packageResolve (node:internal/modules/esm/resolve:857:9)
    at moduleResolve (node:internal/modules/esm/resolve:926:18)
    at defaultResolve (node:internal/modules/esm/resolve:1056:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:654:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:586:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:242:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:135:49)
 ELIFECYCLE  Command failed with exit code 2.
[Command exited with 2, lasted 11.133123792s]
```

Solution
========

- Migrate the eslint config to the new flat config system.
- remove "legacy" typescript-eslint setup

Here is the PR where the breaking change was done
- pnpm/pnpm#8378

More information about the "flat config"
- https://eslint.org/blog/2022/08/new-config-system-part-2/

Other references I used
- pnpm/pnpm#8378
- https://typescript-eslint.io/packages/typescript-eslint/#migrating-from-legacy-config-setups
- sveltejs/cli#374
- sveltejs/cli#375
- nuxt/eslint#539
- pnpm/pnpm#9052
mikavilpas added a commit to mikavilpas/yazi.nvim that referenced this pull request Feb 9, 2025
Issue
=====

Eslint cannot be run after a clean install.

```sh
[Running: fd node_modules --no-ignore --prune -x rm -rf && pnpm i && cd integration-tests && pnpm eslint]
Scope: all 2 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +607
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 607, reused 607, downloaded 0, added 607, done

devDependencies:
+ @umbrelladocs/linkspector 0.3.13
+ markdownlint-cli2 0.17.2
+ prettier 3.4.2
+ prettier-plugin-organize-imports 4.1.0
+ prettier-plugin-packagejson 2.5.8

Done in 4.8s

> @yazi.nvim/[email protected] eslint /Users/mikavilpas/git/yazi.nvim/integration-tests
> eslint --max-warnings=0 .

Oops! Something went wrong! :(

ESLint: 9.20.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@eslint/eslintrc' imported from /Users/mikavilpas/git/yazi.nvim/integration-tests/eslint.config.mjs
Did you mean to import "@eslint/eslintrc/dist/eslintrc.cjs"?
    at packageResolve (node:internal/modules/esm/resolve:857:9)
    at moduleResolve (node:internal/modules/esm/resolve:926:18)
    at defaultResolve (node:internal/modules/esm/resolve:1056:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:654:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:586:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:242:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:135:49)
 ELIFECYCLE  Command failed with exit code 2.
[Command exited with 2, lasted 11.133123792s]
```

Solution
========

- Migrate the eslint config to the new flat config system.
- remove "legacy" typescript-eslint setup

Here is the PR where the breaking change was done
- pnpm/pnpm#8378

More information about the "flat config"
- https://eslint.org/blog/2022/08/new-config-system-part-2/

Other references I used
- pnpm/pnpm#8378
- https://typescript-eslint.io/packages/typescript-eslint/#migrating-from-legacy-config-setups
- sveltejs/cli#374
- sveltejs/cli#375
- nuxt/eslint#539
- pnpm/pnpm#9052
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 this pull request may close these issues.

ESLint config imports a transitive dependency that is not installed (pnpm 10)
3 participants