From dac3ed3858fbf0dbda02f1f5eb8a01034e64a6d7 Mon Sep 17 00:00:00 2001 From: unional Date: Mon, 2 Jan 2023 23:20:25 -0800 Subject: [PATCH 1/2] chore: use prettier as default formatter in vscode This helps contributors to use the right formatter to avoid messing up the style --- .vscode/settings.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index c38b6ef3b307..ce4d32a6b5a1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,7 @@ { + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, "editor.rulers": [80], "editor.codeActionsOnSave": { "source.fixAll.eslint": true From 12361f5627b16d678537ec21452fadb9124dc5b6 Mon Sep 17 00:00:00 2001 From: unional Date: Tue, 3 Jan 2023 00:07:00 -0800 Subject: [PATCH 2/2] chore: add ts.format config Since prettier is used as the default formatter, these setting only affects "organize import" command. Which is what we want. It doesn't work completely, as this: ```ts import type { JestHookSubscriber, UpdateConfigCallback, UsageData, WatchPlugin, } from './types'; ``` will be formatted as: ```ts import type { JestHookSubscriber, UpdateConfigCallback, UsageData, WatchPlugin // <-- comma removed } from './types'; ``` Running format doc (prettier) will fix that. It is better than not having it. --- .vscode/settings.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index ce4d32a6b5a1..18c1bd999547 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,5 +8,7 @@ }, "javascript.validate.enable": false, "jest.jestCommandLine": "yarn jest", + "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false, + "typescript.format.semicolons": "insert", "typescript.tsdk": "node_modules/typescript/lib" }