Fix code formatting

Summary:
Had some horrible dev experience caused by  VSCode and Jest not agreeing what snapshots should look like, every time saving a test in VSCode, it would break the jest snapshots. After investigating eslint and prettier, turned out VSCode itself was the culprit. Caused by a global user setting, but this makes sure nobody else runs into it :)

Also made sure Jest uses the correct prettier settings (it didn't before).

Reviewed By: passy

Differential Revision: D22114656

fbshipit-source-id: aef6c278a668bce049c96aba95c7a5101ca840ad
This commit is contained in:
Michel Weststrate
2020-06-19 03:53:20 -07:00
committed by Facebook GitHub Bot
parent cf9309b039
commit 7b69b96190
3 changed files with 10 additions and 12 deletions

View File

@@ -5,6 +5,7 @@
"eslint.packageManager": "yarn",
"eslint.codeActionsOnSave.mode": "all",
"editor.formatOnSave": true,
"files.trimTrailingWhitespace": false, // This one is broken as it cleans string literals as well, killing Jest snapshots: https://github.com/Microsoft/vscode/issues/52711
"prettier.formatAlreadyFormattedFilesOnSave": false,
"files.eol": "\n",
"editor.codeActionsOnSave": {

View File

@@ -22,18 +22,7 @@ const builtInModules = [
'@emotion/styled',
];
const prettierConfig = {
// arrowParens=always is the default for Prettier 2.0, but other configs
// at Facebook appear to be leaking into this file, which is still on
// Prettier 1.x at the moment, so it is best to be explicit.
arrowParens: 'always',
requirePragma: true,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: false,
jsxBracketSameLine: true,
parser: 'flow',
};
const prettierConfig = require('./.prettierrc');
module.exports = {
parser: 'babel-eslint',

8
desktop/.prettierrc.json Normal file
View File

@@ -0,0 +1,8 @@
{
"arrowParens": "always",
"requirePragma": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": false,
"jsxBracketSameLine": true
}