react-native-macos/packages/eslint-config-react-native-...
Moti Zilberman e0aec42efd Allow single-line template literals without placeholders in test files
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 (https://github.com/facebook/jest/issues/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
2021-05-04 12:33:26 -07:00
..
README.md docs: mention prettier in eslint-config README (#28930) 2020-05-20 03:32:46 -07:00
index.js Allow single-line template literals without placeholders in test files 2021-05-04 12:33:26 -07:00
package.json (eslint-config): update eslint-plugin-react-native (#30350) 2020-12-14 06:12:34 -08:00
yarn.lock (eslint-config): update eslint-plugin-react-native (#30350) 2020-12-14 06:12:34 -08:00

README.md

eslint-config-react-native-community

Version

Installation

yarn add --dev eslint prettier @react-native-community/eslint-config

Note: We're using yarn to install deps. Feel free to change commands to use npm 3+ and npx if you like

Usage

Add to your eslint config (.eslintrc, or eslintConfig field in package.json):

{
    "extends": "@react-native-community"
}