-
Notifications
You must be signed in to change notification settings - Fork 236
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
[no-large-snapshots] Unexpected rules are being enabled for snap files #1559
Comments
Managing what rules are enabled for particular files should be the responsibility of the configurer, not us, since you can change those in ways that we can't pickup - that's why we don't explicitly configure overrides/files in our shared configs, and why the snapshot processor was removed in the first place (as there are some other rules people did want to apply to their snapshots). Could you share more details about the setup and config you're using? |
We use
|
I believe this primarily boils down to your configuration - the processor had a So then it comes down to your config: if you structured your config in a way that meant snapshot files would be targeted by a particular rule then yes it would be run regardless of the processor, and by extension ensuring what rules are applied to snapshots is something for you to manage - off the top of my head I'm pretty sure so long as you're not using That might also be the case if you are using The good news is from what I understand about how flat config works this should be a lot simpler since |
I'd say it's quite unexpected that eslint recommended rules, which don't make any sense for snapshots, began to apply to them. And the only option to effectively address this issue for many projects is to introduce own preprocessor. |
|
Yeah sorry that's me mixing up the docs - pre v9 it's called |
Ok so to recap I think there's three main ways you can address this:
Keep in mind one of the reasons removing the processor came up was because people wanted to run other ESLint rules against their snapshots - so restoring it would only serve your case. On the note of performance and maintenance: that's on you as the configurer - as a plugin, we have no way to prevent you from running rules on files; the best we can do is filter out messages from rules after they've been run via |
I think we'll go with option 1, but it would probably be a good idea to document it in |
Since snapshot processor has been removed in #1532 (v28.0), we see that unexpected rules are now being enabled for
.snap
files from ESLint config, which didn't previously run. Because snap files are generated, it doesn't generally make sense to run the same rule set as the rest of the source code, and disabling such rules via overrides seems like overhead.It would be good to either have an option to restore the previous behavior where only
no-large-snapshots
rule was enabled for snapshots, or to minimize the overhead.Steps to reproduce:
no-large-snapshots
docsno-irregular-whitespace
The text was updated successfully, but these errors were encountered: