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

chore(eslint): migrate eslint to avoid pnpm dep hoisting issue #747

Merged
merged 1 commit into from
Feb 9, 2025

Conversation

mikavilpas
Copy link
Owner

Issue

Eslint cannot be run after a clean install.

[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

More information about the "flat config"

Other references I used

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 mikavilpas enabled auto-merge (squash) February 9, 2025 19:20
@mikavilpas mikavilpas merged commit 8ca8653 into main Feb 9, 2025
16 checks passed
@mikavilpas mikavilpas deleted the hotfix-eslint branch February 9, 2025 19:25
mikavilpas added a commit to mikavilpas/blink-ripgrep.nvim that referenced this pull request Feb 10, 2025
mikavilpas added a commit to mikavilpas/blink-ripgrep.nvim that referenced this pull request Feb 10, 2025
mikavilpas added a commit to mikavilpas/blink-ripgrep.nvim that referenced this pull request Feb 10, 2025
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.

1 participant