Skip to content

Commit d2b92ff

Browse files
Justkantfacebook-github-bot
authored andcommitted
Use eslint-plugin-prettier recommended config (#25674)
Summary: I created a new test project today using RN 0.60.3 and saw that prettier is now used with eslint. After looking at the `react-native-community` eslint config, I notice that it wasn't using the [recommended configuration](https://github.com/prettier/eslint-plugin-prettier#recommended-configuration) of `eslint-plugin-prettier` This PR adds the `eslint-config-prettier` to avoid conflicts between eslint and prettier, it also adds the `prettier/react` config to avoid problems with the `eslint-plugin-react`. ## Changelog [General] [Changed] - Use eslint-plugin-prettier recommended config Pull Request resolved: #25674 Test Plan: - ✅ Ensure there is no difference on this repo (no ESLint errors, same number of warnings, and no changes when running prettier). Differential Revision: D16666178 Pulled By: cpojer fbshipit-source-id: 70f81db793866acc88388b7b00a496aab5e0b156
1 parent 2e32b8c commit d2b92ff

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
"eslint": "5.1.0",
128128
"eslint-config-fb-strict": "24.3.0",
129129
"eslint-config-fbjs": "2.1.0",
130+
"eslint-config-prettier": "^6.0.0",
130131
"eslint-plugin-babel": "^5.3.0",
131132
"eslint-plugin-eslint-comments": "^3.1.1",
132133
"eslint-plugin-flowtype": "2.50.3",

packages/eslint-config-react-native-community/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ module.exports = {
1616
sourceType: 'module',
1717
},
1818

19+
extends: [
20+
'plugin:prettier/recommended', // https://github.com/prettier/eslint-plugin-prettier#recommended-configuration
21+
'prettier/react',
22+
],
23+
1924
plugins: [
2025
'eslint-comments',
21-
'prettier',
2226
'react',
2327
'react-hooks',
2428
'react-native',
@@ -219,10 +223,6 @@ module.exports = {
219223
'eslint-comments/no-unused-disable': 1, // disallow disables that don't cover any errors
220224
'eslint-comments/no-unused-enable': 1, // // disallow enables that don't enable anything or enable rules that weren't disabled
221225

222-
// Prettier Plugin
223-
// https://github.com/prettier/eslint-plugin-prettier
224-
'prettier/prettier': 2,
225-
226226
// Stylistic Issues
227227
// These rules are purely matters of style and are quite subjective.
228228

packages/eslint-config-react-native-community/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"@typescript-eslint/eslint-plugin": "^1.5.0",
1212
"@typescript-eslint/parser": "^1.5.0",
1313
"babel-eslint": "10.0.1",
14+
"eslint-config-prettier": "^6.0.0",
1415
"eslint-plugin-eslint-comments": "^3.1.1",
1516
"eslint-plugin-flowtype": "2.50.3",
1617
"eslint-plugin-jest": "22.4.1",

packages/eslint-config-react-native-community/yarn.lock

+12
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,13 @@ escape-string-regexp@^1.0.5:
327327
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
328328
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
329329

330+
eslint-config-prettier@^6.0.0:
331+
version "6.0.0"
332+
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.0.0.tgz#f429a53bde9fc7660e6353910fd996d6284d3c25"
333+
integrity sha512-vDrcCFE3+2ixNT5H83g28bO/uYAwibJxerXPj+E7op4qzBCsAV36QfvdAyVOoNxKAH2Os/e01T/2x++V0LPukA==
334+
dependencies:
335+
get-stdin "^6.0.0"
336+
330337
eslint-plugin-eslint-comments@^3.1.1:
331338
version "3.1.1"
332339
resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.1.1.tgz#32ff0afba8a48e17073817e6d03fbc5622f735b7"
@@ -563,6 +570,11 @@ functional-red-black-tree@^1.0.1:
563570
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
564571
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
565572

573+
get-stdin@^6.0.0:
574+
version "6.0.0"
575+
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b"
576+
integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==
577+
566578
glob@^7.1.2, glob@^7.1.3:
567579
version "7.1.3"
568580
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"

yarn.lock

+12
Original file line numberDiff line numberDiff line change
@@ -2635,6 +2635,13 @@ [email protected], eslint-config-fbjs@^2.1.0:
26352635
resolved "https://registry.yarnpkg.com/eslint-config-fbjs/-/eslint-config-fbjs-2.1.0.tgz#bfe4f8c2d2282bfe515359553905d830e3a5d12f"
26362636
integrity sha512-wh7Lveo51V3/SUydWtR2VEU8wNfSHt5V7YzIUKTRkHF3kvkCwFtM6Jgsn+xBNkjxZGpfWgNJN/drk1LLx64Dww==
26372637

2638+
eslint-config-prettier@^6.0.0:
2639+
version "6.0.0"
2640+
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.0.0.tgz#f429a53bde9fc7660e6353910fd996d6284d3c25"
2641+
integrity sha512-vDrcCFE3+2ixNT5H83g28bO/uYAwibJxerXPj+E7op4qzBCsAV36QfvdAyVOoNxKAH2Os/e01T/2x++V0LPukA==
2642+
dependencies:
2643+
get-stdin "^6.0.0"
2644+
26382645
eslint-plugin-babel@^5.3.0:
26392646
version "5.3.0"
26402647
resolved "https://registry.yarnpkg.com/eslint-plugin-babel/-/eslint-plugin-babel-5.3.0.tgz#2e7f251ccc249326da760c1a4c948a91c32d0023"
@@ -3288,6 +3295,11 @@ get-port@^2.1.0:
32883295
dependencies:
32893296
pinkie-promise "^2.0.0"
32903297

3298+
get-stdin@^6.0.0:
3299+
version "6.0.0"
3300+
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b"
3301+
integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==
3302+
32913303
get-stream@^3.0.0:
32923304
version "3.0.0"
32933305
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"

0 commit comments

Comments
 (0)