-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Single line inline snapshots conflict with babel/quotes
in eslint
#10164
Comments
We use
At work to work around it. Changing quotation impacts escaping and such, but maybe not an issue? |
Summary: Our ESLint configuration currently disallows template literals that can be expressed using plain string syntax (with single quotes). Jest's inline snapshots feature sometimes produces such template literals. This not only adds unnecessary friction from the linter, but can break subsequent snapshot updates in a test file (after accepting the ESLint autofix). This conflict between Jest and ESLint is a known issue (jestjs/jest#10164) with no upstream fix. Here we relax the linter's settings to allow all template literals in test files. Ideally we could allow them *only* in inline snapshots, but this is a reasonable approximation. Changelog: [Internal] Reviewed By: MichaReiser Differential Revision: D28120785 fbshipit-source-id: c6c6c0ab8a3b8aca14df06f430b777cef42cd554
Summary: Our ESLint configuration currently disallows template literals that can be expressed using plain string syntax (with single quotes). Jest's inline snapshots feature sometimes produces such template literals. This not only adds unnecessary friction from the linter, but can break subsequent snapshot updates in a test file (after accepting the ESLint autofix). This conflict between Jest and ESLint is a known issue (jestjs/jest#10164) with no upstream fix. Here we relax the linter's settings to allow all template literals in test files. Ideally we could allow them *only* in inline snapshots, but this is a reasonable approximation. Changelog: [Internal] Reviewed By: MichaReiser Differential Revision: D28120785 fbshipit-source-id: c6c6c0ab8a3b8aca14df06f430b777cef42cd554
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
When I have an assertion like:
eslint will report this issue in some setups:
This is not ideal. Could we change the snapshot inliner to use single-quotes if the result is only a single line?
The text was updated successfully, but these errors were encountered: