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: disable no-undef ESLint rule in TypeScript project #483

Merged
merged 3 commits into from
Mar 23, 2025

Conversation

baseballyama
Copy link
Member

close: #481

Copy link

changeset-bot bot commented Mar 12, 2025

🦋 Changeset detected

Latest commit: 4fbf70f

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 Mar 12, 2025

Open in Stackblitz

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

commit: 4fbf70f

@baseballyama baseballyama requested a review from manuel3108 March 13, 2025 00:25
Copy link
Member

@manuel3108 manuel3108 left a comment

Choose a reason for hiding this comment

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

Maybe I'm missing something, but in #481 you are writing about no-undef, and your PR seems to mix and match no-undef and no-unused-vars randomly.

More importantly, I deleted the eslint.config.js in the repro provided and run pnpm dlx https://pkg.pr.new/sveltejs/cli/sv@483 which still revealed the original error.

I'm assuming your PR was meant for no-undef?

@svelte-docs-bot
Copy link

@baseballyama baseballyama changed the title chore: disable no-unused-vars ESLint rule in TypeScript project chore: disable no-undef ESLint rule in TypeScript project Mar 17, 2025
@baseballyama
Copy link
Member Author

@manuel3108 Sorry, I got confused for some reason. Fixed now!

@baseballyama baseballyama requested a review from manuel3108 March 17, 2025 14:46
Copy link
Member

@manuel3108 manuel3108 left a comment

Choose a reason for hiding this comment

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

Apart from the one thing, everything seems to be working as expected now.

Edit: I can have a look later this week if you want

@@ -85,11 +85,25 @@ export default defineAddon({
const globalsNode = common.createSpreadElement(common.expressionFromString('globals.node'));
const globalsObjLiteral = object.createEmpty();
globalsObjLiteral.properties = [globalsBrowser, globalsNode];
const off = common.createLiteral('off');
off.comments = [
Copy link
Member

Choose a reason for hiding this comment

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

Without running prettier, this generates the following code:
image

The comment probably needs to be added to the rules variable or something like this

Copy link
Member Author

Choose a reason for hiding this comment

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

I also thought about whether there was a better way, but it seemed a bit difficult. Since it gets formatted correctly by Prettier, as you mentioned, I decided to leave it as it is.😅

I will take a closer look at it tomorrow.

Copy link
Member

Choose a reason for hiding this comment

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

Problem is that not everyone has prettier installed, and we only run prettier if prettier was already setup by the user or the cli. So there is a chance users will see this.

Thanks for your help!

@baseballyama baseballyama force-pushed the chore/disable-no-undef branch from 909905e to 827337c Compare March 22, 2025 16:29
@baseballyama
Copy link
Member Author

@manuel3108

I think the format is much better now. The only remaining issue is the indentation, but I this we can split the PR to fix it.

@baseballyama baseballyama requested a review from manuel3108 March 22, 2025 17:49
Copy link
Member

@manuel3108 manuel3108 left a comment

Choose a reason for hiding this comment

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

Thats perfect now, thanks!

Indentation should be fixed by #380 in theory, so I don't think we need to bother about this now, as you said!

@manuel3108 manuel3108 merged commit d2a9927 into main Mar 23, 2025
7 checks passed
@manuel3108 manuel3108 deleted the chore/disable-no-undef branch March 23, 2025 07:19
@github-actions github-actions bot mentioned this pull request Mar 23, 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.

Types in app.d.ts are only globally imported under src/routes/
2 participants