Skip to content

Commit

Permalink
Allow single-line template literals without placeholders in test files
Browse files Browse the repository at this point in the history
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
  • Loading branch information
motiz88 authored and facebook-github-bot committed May 4, 2021
1 parent 8abe737 commit e0aec42
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/eslint-config-react-native-community/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ module.exports = {
},
rules: {
'react-native/no-inline-styles': 0,
quotes: [1, 'single', {avoidEscape: true, allowTemplateLiterals: true}],
},
},
],
Expand Down

0 comments on commit e0aec42

Please sign in to comment.