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!: update recommended config #1033

Merged
merged 3 commits into from
Jan 26, 2025
Merged

Conversation

baseballyama
Copy link
Member

@baseballyama baseballyama commented Jan 19, 2025

close: #755
close: #785
close: #894

Copy link

pkg-pr-new bot commented Jan 19, 2025

Open in Stackblitz

npm i https://pkg.pr.new/eslint-plugin-svelte@1033

commit: 7d1bdf4

@baseballyama baseballyama force-pushed the breaking/update-recommended branch from 44282f1 to a390730 Compare January 19, 2025 03:02
Copy link

changeset-bot bot commented Jan 19, 2025

🦋 Changeset detected

Latest commit: 7d1bdf4

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

This PR includes changesets to release 1 package
Name Type
eslint-plugin-svelte Major

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

@baseballyama baseballyama force-pushed the breaking/update-recommended branch from a390730 to 6532e5b Compare January 19, 2025 03:28
@baseballyama baseballyama changed the title chore: update recommended config chore!: update recommended config Jan 19, 2025
@baseballyama baseballyama force-pushed the breaking/update-recommended branch from 6532e5b to aeac0ad Compare January 19, 2025 03:31
@baseballyama baseballyama marked this pull request as ready for review January 19, 2025 04:14
@baseballyama
Copy link
Member Author

@ota-meshi
The current configuration seems quite aggressive. Could you share your thoughts on which rules should be included as recommended?

@ota-meshi
Copy link
Member

ota-meshi commented Jan 22, 2025

I like this new config 👍

I think it might be a good idea to remove valid-compile from the recommended config. What do you think?
This rule was added for compatibility with eslint-plugin-svelte3.

@marekdedic
Copy link
Contributor

Hi, thanks, I am thinking about whether these shouldn't be added as well (in decreasing order of certainty):

  • svelte/no-navigation-without-base - This one warns about what is incorrect code (though it may be fixed in SvelteKit at some point in the future)
  • svelte/button-has-type - This one is about what is considered best practice
  • svelte/no-unused-class-name - This one is more about unused code...

@baseballyama
Copy link
Member Author

svelte/no-navigation-without-base

I don’t think this needs to be added. (In fact, it’s better not to add it.) This is because it would result in meaningless linting errors for users who don’t use basepath. Only users who use basepath should opt in to this rule.

svelte/button-has-type

This is not included in the recommended rules for Vue either. IIRC it was added to the Vue's recommended config once before but was removed due to user pushback.
vuejs/eslint-plugin-vue#1432

svelte/no-unused-class-name

This was initially added, but in the codebases I tested, false positives occurred. Therefore, I judged that it was not mature enough to be included in the recommended rules.

@marekdedic
Copy link
Contributor

Thanks, in reverse order now :D

svelte/no-unused-class-name

This was initially added, but in the codebases I tested, false positives occurred. Therefore, I judged that it was not mature enough to be included in the recommended rules.

Hmm, if it has too many FPs, it shouldn't be added , I agree. Could you open an issue for the FPs? I'd like to fix them (regardless of the recommended config)

svelte/button-has-type

This is not included in the recommended rules for Vue either. IIRC it was added to the Vue's recommended config once before but was removed due to user pushback.

I can't find anything about the removal, maybe @ota-meshi can explain what the reason was?

svelte/no-navigation-without-base

I don’t think this needs to be added. (In fact, it’s better not to add it.) This is because it would result in meaningless linting errors for users who don’t use basepath. Only users who use basepath should opt in to this rule.

I am torn on this one - on the one hand, it would be more warnings for users, on the other, I consider not adding the base path to be incorrect - if the code is e.g. reused in the future, this is a serious foot-gun (So much so that the SvelteKit team considers fixing it on their end).

@baseballyama
Copy link
Member Author

I am torn on this one - on the one hand, it would be more warnings for users, on the other, I consider not adding the base path to be incorrect - if the code is e.g. reused in the future, this is a serious foot-gun (So much so that the SvelteKit team considers fixing it on their end).

IMO:
Whether to reuse the code with a different basepath is up to each project. If there’s no chance of reuse, we don’t need to consider the basepath at all. If it turns out later that a basepath is needed, we can simply opt into this rule and make adjustments then.

Code is read more often than it is written, so reducing unnecessary noise is important. For projects where the basepath doesn’t need to be considered, the code added by this rule would just become noise.

@ota-meshi
Copy link
Member

The config provided by eslint-plugin-vue follows the Vue style guide, so if something is not mentioned in the style guide, it will not be added to the config. Therefore, the vue/button-has-type rule is not included in the config.

However, neither react/button-has-type nor @angular-eslint/template/button-has-type seem to be included in the config provided by those plugins.
Therefore, it seems reasonable to not include svelte/button-has-type in the config either.

@baseballyama
Copy link
Member Author

I believe we’ve agreed on the recommended config. Finally, I’ll document the changes in detail in the changeset and wrap it up.

@baseballyama baseballyama force-pushed the breaking/update-recommended branch from 0143138 to a93dd61 Compare January 26, 2025 01:55
Copy link
Member

@ota-meshi ota-meshi 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 very much!

@ota-meshi ota-meshi merged commit 3bfcc31 into main Jan 26, 2025
18 checks passed
@ota-meshi ota-meshi deleted the breaking/update-recommended branch January 26, 2025 07:03
@baseballyama baseballyama mentioned this pull request Jan 26, 2025
25 tasks
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.

Rule deprecation request Addition of a config that includes best practice rules. Clean up configs
3 participants