From f2f80487d5d8320f51f1d6fc8974ee175c94e9dd Mon Sep 17 00:00:00 2001 From: David Humphrey Date: Thu, 23 Sep 2021 18:27:41 -0400 Subject: [PATCH] Use global prettier config/ignore for all check and check-format scripts (#17820) * Add tsdoc-metadata.json to .prettierignore for @azure/core-rest-pipeline failure, see #14681 * Fix paths to .prettierrc.json and .prettierignore in @azure-tools/perf-container-registery package.json * Run prettier with prettierrc.json config on sdk/test-utils/testing-recorder-new/rollup.base.config.js * Use global prettier config and ignore for identity/identity/test/manual * Use global prettier config and ignore in common/tools/eslint-plugin-azure-sdk --- .prettierignore | 1 + .../eslint-plugin-azure-sdk/package.json | 4 ++-- .../container-registry/package.json | 4 ++-- .../identity/test/manual/package.json | 3 ++- .../identity/test/manual/src/index.tsx | 20 ++++++++----------- .../rollup.base.config.js | 4 +--- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/.prettierignore b/.prettierignore index 55583adb4d3a..93c1296dcdfe 100644 --- a/.prettierignore +++ b/.prettierignore @@ -5,3 +5,4 @@ **/*.yaml **/*.d.ts .env +tsdoc-metadata.json diff --git a/common/tools/eslint-plugin-azure-sdk/package.json b/common/tools/eslint-plugin-azure-sdk/package.json index 134a7a6d74cf..a6de82d5bb74 100644 --- a/common/tools/eslint-plugin-azure-sdk/package.json +++ b/common/tools/eslint-plugin-azure-sdk/package.json @@ -40,8 +40,8 @@ "build:samples": "echo Skipped.", "build:test": "npm run clean && tsc -p tsconfig.json", "clean": "rimraf dist/", - "format": "prettier --write \"./**/*.{ts,json,md}\"", - "check-format": "prettier --check \"./**/*.{ts,json,md}\"", + "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"./**/*.{ts,json,md}\"", + "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"./**/*.{ts,json,md}\"", "lint": "eslint src tests --ext .ts", "pack": "npm pack 2>&1", "prebuild": "npm run clean", diff --git a/sdk/containerregistry/perf-tests/container-registry/package.json b/sdk/containerregistry/perf-tests/container-registry/package.json index b95a67f58274..e47ff5e90396 100644 --- a/sdk/containerregistry/perf-tests/container-registry/package.json +++ b/sdk/containerregistry/perf-tests/container-registry/package.json @@ -27,9 +27,9 @@ "build": "tsc -p .", "build:samples": "echo skipped", "build:test": "echo skipped", - "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "check-format": "prettier --list-different --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "clean": "rimraf dist dist-esm test-dist types *.tgz *.log", - "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "format": "prettier --write --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "integration-test:browser": "echo skipped", "integration-test:node": "echo skipped", "integration-test": "echo skipped", diff --git a/sdk/identity/identity/test/manual/package.json b/sdk/identity/identity/test/manual/package.json index 62b09f118173..a4dadc844321 100644 --- a/sdk/identity/identity/test/manual/package.json +++ b/sdk/identity/identity/test/manual/package.json @@ -6,7 +6,8 @@ "scripts": { "build": "webpack --config webpack.config.js", "start": "webpack-dev-server", - "format": "prettier --write \"src/**/*.tsx\"" + "check-format": "prettier --list-different --config ../../../../../.prettierrc.json --ignore-path ../../../../../.prettierignore \"src/**/*.tsx\"", + "format": "prettier --write --config ../../../../../.prettierrc.json --ignore-path ../../../../../.prettierignore \"src/**/*.tsx\"" }, "author": "Microsoft Corporation", "license": "MIT", diff --git a/sdk/identity/identity/test/manual/src/index.tsx b/sdk/identity/identity/test/manual/src/index.tsx index 6839b05eec64..5d920882e974 100644 --- a/sdk/identity/identity/test/manual/src/index.tsx +++ b/sdk/identity/identity/test/manual/src/index.tsx @@ -4,10 +4,7 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; -import { - InteractiveBrowserCredential, - BrowserLoginStyle -} from "@azure/identity"; +import { InteractiveBrowserCredential, BrowserLoginStyle } from "@azure/identity"; import { ServiceBusClient } from "@azure/service-bus"; interface ClientDetails { @@ -82,7 +79,7 @@ function getCredential( cachedCredential = new InteractiveBrowserCredential({ tenantId, clientId, - loginStyle + loginStyle, }); lastLoginStyle = clientDetails.loginStyle; return cachedCredential; @@ -95,13 +92,12 @@ function ClientDetailsEditor({ clientDetails, onSetClientDetails }: ClientDetail onSetClientDetails(newDetails); }; - const setDetail = (name: keyof ClientDetails, changeValue?: (v: string) => any) => ( - value: string - ) => - handleDetailsChange({ - ...clientDetails, - [name]: changeValue ? changeValue(value) : value, - }); + const setDetail = + (name: keyof ClientDetails, changeValue?: (v: string) => any) => (value: string) => + handleDetailsChange({ + ...clientDetails, + [name]: changeValue ? changeValue(value) : value, + }); return (
diff --git a/sdk/test-utils/testing-recorder-new/rollup.base.config.js b/sdk/test-utils/testing-recorder-new/rollup.base.config.js index 6a274be35d48..53e2408d9480 100644 --- a/sdk/test-utils/testing-recorder-new/rollup.base.config.js +++ b/sdk/test-utils/testing-recorder-new/rollup.base.config.js @@ -100,9 +100,7 @@ export function browserConfig(test = false) { }; if (test) { - baseConfig.input = [ - "dist-esm/test/*.spec.js" - ]; + baseConfig.input = ["dist-esm/test/*.spec.js"]; baseConfig.plugins.unshift(multiEntry({ exports: false })); baseConfig.output.file = "dist-test/index.browser.js";