diff --git a/.vscode/extensions.json b/.vscode/extensions.json index d09daa2d55e0..f23f12deef48 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,7 @@ { - "recommendations": [ - "EditorConfig.EditorConfig", - "docsmsft.docs-authoring-pack" - ] + "recommendations": [ + "EditorConfig.EditorConfig", + "esbenp.prettier-vscode", + "docsmsft.docs-authoring-pack" + ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 86500570ba6b..81c95f4d9519 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -20,5 +20,8 @@ "url":"https://raw.githubusercontent.com/Azure/autorest/master/schema/composite-swagger.json" } ], - "typescript.tsdk": "node_modules\\typescript\\lib" -} \ No newline at end of file + "typescript.tsdk": "node_modules\\typescript\\lib", + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } +} diff --git a/documentation/ci-fix.md b/documentation/ci-fix.md new file mode 100644 index 000000000000..92de1bfc14ce --- /dev/null +++ b/documentation/ci-fix.md @@ -0,0 +1,21 @@ +# CI Fix Guide + +Here are guides to fix some of the CI failure. + +## Spell check + +Please add your words to `./custom-words.txt` if you think you have the correct spell + +## Prettier check + +Please run the following command: + +`sh +npm install; npm run prettier-fix +` + +Or if you want to fix specified service: + +`sh +npm install; npm run prettier -- --write "specification//**/*.json" +` diff --git a/package.json b/package.json index 103684cd9b1b..8719d7155268 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "test": "tsc && mocha -t 500000 --reporter min", "spellcheck": "ts-node ./scripts/spellcheck.ts", "prettier-check": "ts-node ./scripts/prettier-check.ts", + "prettier-fix": "prettier --write specification/**/*.json", "prettier": "prettier", "tsc": "tsc", "multiapi": "ts-node ./scripts/multiapi.ts" diff --git a/scripts/prettier-check.ts b/scripts/prettier-check.ts index 5e3661cdcb3a..ce869a60b8d1 100644 --- a/scripts/prettier-check.ts +++ b/scripts/prettier-check.ts @@ -17,6 +17,6 @@ runCheckOverChangedSpecFiles({ }, onFinalFailed: async () => { - logError('Code style issues found in the above file(s). Please run `npm install && npm run prettier -- --write "specification//**/*.json"` to fix.') + logError('Code style issues found in the above file(s). Please follow https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/ci-fix.md') } }) \ No newline at end of file