Skip to content

test(integration): ensure typescript-eslint packages are consistent #705

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

Merged
merged 1 commit into from
Apr 19, 2025

Conversation

mcous
Copy link
Contributor

@mcous mcous commented Apr 17, 2025

After a fresh clone of this repository, I tried running pnpm test. Every single one of the integration tests failed with:

  1) Integration tests.
       /Users/mc/cloned/svelte-eslint-parser/tests/fixtures/integrations/snippet-scope/snippet-shadow-scope-input.svelte:
     /Users/mc/cloned/svelte-eslint-parser/tests/fixtures/integrations/snippet-scope/snippet-shadow-scope-setup.ts:3
import { rules } from "@typescript-eslint/eslint-plugin";
         ^

SyntaxError: The requested module '@typescript-eslint/eslint-plugin' does not provide an export named 'rules'
      at ModuleJob._instantiate (node:internal/modules/esm/module_job:180:21)
      at async ModuleJob.run (node:internal/modules/esm/module_job:263:5)
      at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:578:26)
      at async Context.<anonymous> (tests/src/integrations.ts:33:11)

This was a really strange error to see! After inspecting the package.json and node_modules layout, my best guess is that this issue is due to a mismatch in the various @typescript-eslint dependencies in this project:

// >=8.29.0 <8.30
"@typescript-eslint/parser": "~8.29.0",
// ...
// >=8.28.0 <9
"typescript-eslint": "^8.28.0",

This was causing multiple copies of @typescript-eslint/parser etc. to be installed:

❯ pnpm why @typescript-eslint/parser
Legend: production dependency, optional only, dev only

[email protected] /Users/mc/cloned/svelte-eslint-parser

devDependencies:
@typescript-eslint/eslint-plugin 8.30.1
└── @typescript-eslint/parser 8.29.1 peer
@typescript-eslint/parser 8.29.1
typescript-eslint 8.30.1
├─┬ @typescript-eslint/eslint-plugin 8.30.1
│ └── @typescript-eslint/parser 8.30.1 peer
└── @typescript-eslint/parser 8.30.1
typescript-eslint-parser-for-extra-files 0.8.0
└── @typescript-eslint/parser 8.29.1 peer

This PR resolves the versioning discrepancy and pulls the plugin in integration tests from typescript-eslint for consistency

Copy link

changeset-bot bot commented Apr 17, 2025

⚠️ No Changeset found

Latest commit: 2f5fb91

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@@ -0,0 +1 @@
export default {};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this file to ensure that my editor picked up Prettier defaults - which this repository seems to follow - rather than my own person defaults. Let me know if you'd like me to remove it from this PR

Copy link
Contributor

Try the Instant Preview in Online Playground

ESLint Online Playground

Install the Instant Preview to Your Local

npm i https://pkg.pr.new/svelte-eslint-parser@2f5fb91

Published Instant Preview Packages:

View Commit

@coveralls
Copy link

Pull Request Test Coverage Report for Build 14519384579

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 94.668%

Totals Coverage Status
Change from base Build 14415394500: 0.0%
Covered Lines: 10491
Relevant Lines: 10958

💛 - Coveralls

Copy link
Member

@baseballyama baseballyama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THank you!

@baseballyama baseballyama merged commit 3f5405b into sveltejs:main Apr 19, 2025
12 checks passed
@mcous mcous deleted the test/align-ts-eslint-version branch April 19, 2025 17:46
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.

3 participants