From 65eea9d1f82215f7dd10241a3cc1045b6ac3918a Mon Sep 17 00:00:00 2001 From: Matt Oakes Date: Mon, 29 Apr 2019 09:41:36 -0700 Subject: [PATCH] Set the Prettier config so it is not forced on users of @react-native-community/eslint-config (#24635) Summary: This fixes an issue where the Prettier config was set to the `fb` (Facebook) values for all users of the `react-native-community/eslint-config` package. This was due to [this line](https://github.com/facebook/react-native/blob/8f186b84aeeb2613bf6ae08f20a8547d40179007/packages/eslint-config-react-native-community/index.js#L219) in the config file. It was causing issues like these: * Errors when using newer versions of `eslint-plugin-prettier` (you had to use a version that was >1 year old): https://github.com/facebook/react-native/issues/24564 * Errors due to the Prettier parser being forced to be `flow` when using Typescript: https://github.com/typescript-eslint/typescript-eslint/issues/481 This PR: * Changes that line to remove the explicit `fb` config so users can set their own. * Moves the React Native Prettier config to `.prettierrc` so ESLint, Prettier, and code editors can all read from the same place. * Upgrades both `prettier` and the `eslint-plugin-prettier` to the latest versions. [General] [Fixed] - Stopped the Prettier config being set for all users of react-native-community/eslint-config Pull Request resolved: https://github.com/facebook/react-native/pull/24635 Differential Revision: D15122200 Pulled By: cpojer fbshipit-source-id: 56bae8a7f2d8e133b1d808091a6b73302b94d2ed --- .prettierrc | 7 +++++++ package.json | 8 -------- packages/eslint-config-react-native-community/index.js | 2 +- yarn.lock | 5 ----- 4 files changed, 8 insertions(+), 14 deletions(-) create mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000000..20374fd919f --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "requirePragma": true, + "singleQuote": true, + "trailingComma": "all", + "bracketSpacing": false, + "jsxBracketSameLine": true +} diff --git a/package.json b/package.json index a70cf91efb2..81ee755b2bd 100644 --- a/package.json +++ b/package.json @@ -11,14 +11,6 @@ "engines": { "node": ">=8.3" }, - "prettier": { - "requirePragma": true, - "singleQuote": true, - "trailingComma": "all", - "bracketSpacing": false, - "jsxBracketSameLine": true, - "parser": "flow" - }, "jest-junit": { "outputDirectory": "reports/junit", "outputName": "js-test-results.xml" diff --git a/packages/eslint-config-react-native-community/index.js b/packages/eslint-config-react-native-community/index.js index 3c40a09a5dd..d1cfc694871 100644 --- a/packages/eslint-config-react-native-community/index.js +++ b/packages/eslint-config-react-native-community/index.js @@ -216,7 +216,7 @@ module.exports = { // Prettier Plugin // https://github.com/prettier/eslint-plugin-prettier - 'prettier/prettier': [2, 'fb', '@format'], + 'prettier/prettier': 2, // Stylistic Issues // These rules are purely matters of style and are quite subjective. diff --git a/yarn.lock b/yarn.lock index 6b6aba3fb0c..8b295918693 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6033,11 +6033,6 @@ react-is@^16.8.3: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.3.tgz#4ad8b029c2a718fc0cfc746c8d4e1b7221e5387d" integrity sha512-Y4rC1ZJmsxxkkPuMLwvKvlL1Zfpbcu+Bf4ZigkHup3v9EfdYhAlWAaVyA19olXq2o2mGn0w+dFKvk3pVVlYcIA== -react-native-dummy@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/react-native-dummy/-/react-native-dummy-0.2.0.tgz#fbf0ff7607506882648f1b07f76e57951b7b8f8a" - integrity sha512-8efApfdopDKGdxbG8aMmYDXt33aZUoFIU+kRxrsdvVAtV2m121tVFrgV8pHr7M+Y7iuOl80wuxt6Xx8zclCIpQ== - react-proxy@^1.1.7: version "1.1.8" resolved "https://registry.yarnpkg.com/react-proxy/-/react-proxy-1.1.8.tgz#9dbfd9d927528c3aa9f444e4558c37830ab8c26a"