From 2216954b9e0efadc5223c2346b4cb31e20c8bc12 Mon Sep 17 00:00:00 2001 From: Jason Morse <35609178+JasonVMo@users.noreply.github.com> Date: Mon, 17 Aug 2020 14:54:38 -0700 Subject: [PATCH] Integrate dependency checker into CI and fix dependency errors (#392) * add depcheck command to repo * fix more dependencies * fix dependency errors * fix last few dependency issues * more dependency fixes and integrate into buildci * workaround depcheck bad report * Change files * add prettier and extension updates to (hopefully) ensure consistency * fix bad merge * Change files --- .vscode/extensions.json | 9 ++ .vscode/settings.json | 59 ++++++-- apps/fluent-tester/package.json | 14 +- .../src/RNTester/FabricTester.tsx | 12 +- .../TestComponents/Button/ButtonFocusTest.tsx | 7 +- .../TestComponents/Button/ButtonIconTest.tsx | 4 +- .../TestComponents/Checkbox/CheckboxTest.tsx | 67 ++++----- .../RNTester/TestComponents/Common/Slider.tsx | 23 ++- .../ContextualMenu/ContextualMenuTest.tsx | 35 +++-- .../FocusTrapZone/FocusTrapZoneTest.tsx | 34 ++--- .../RNTester/TestComponents/Link/LinkTest.tsx | 23 ++- .../TestComponents/Persona/CustomizeUsage.tsx | 8 +- .../TestComponents/Persona/StandardUsage.tsx | 7 +- .../PersonaCoin/CustomizeUsage.tsx | 8 +- .../PersonaCoin/StandardUsage.tsx | 12 +- .../Pressable/PressableTest.tsx | 36 ++--- .../RadioGroup/RadioGroupTest.tsx | 21 ++- .../Separator/SeparatorTest.tsx | 24 ++- .../src/RNTester/TestComponents/Test.tsx | 56 +++---- .../TestComponents/Text/CustomizeUsage.tsx | 2 +- .../TestComponents/Text/StandardUsage.tsx | 2 +- .../TestComponents/Theme/ThemeTest.tsx | 37 ++--- apps/ios/package.json | 9 +- apps/macos/package.json | 15 +- apps/win32/package.json | 3 +- apps/win32/react-native.config.js | 5 - apps/windows/package.json | 7 + ...t-native-2020-08-12-12-47-49-depcheck.json | 8 + ...adapters-2020-08-12-12-47-49-depcheck.json | 8 + ...adapters-2020-08-12-23-43-57-depcheck.json | 8 + ...e-button-2020-08-12-12-47-49-depcheck.json | 8 + ...-callout-2020-08-12-12-47-49-depcheck.json | 8 + ...checkbox-2020-08-12-12-47-49-depcheck.json | 8 + ...position-2020-08-12-12-47-49-depcheck.json | 8 + ...ual-menu-2020-08-12-12-47-49-depcheck.json | 8 + ...ramework-2020-08-12-12-47-49-depcheck.json | 8 + ...rap-zone-2020-08-12-12-47-49-depcheck.json | 8 + ...le-merge-2020-08-12-23-43-57-depcheck.json | 8 + ...ve-hooks-2020-08-12-12-47-49-depcheck.json | 8 + ...ve-hooks-2020-08-12-23-43-57-depcheck.json | 8 + ...ive-link-2020-08-12-12-47-49-depcheck.json | 8 + ...mo-cache-2020-08-12-12-47-49-depcheck.json | 8 + ...mo-cache-2020-08-12-23-43-57-depcheck.json | 8 + ...-persona-2020-08-12-12-47-49-depcheck.json | 8 + ...ona-coin-2020-08-12-12-47-49-depcheck.json | 8 + ...ressable-2020-08-12-12-47-49-depcheck.json | 8 + ...io-group-2020-08-12-12-47-49-depcheck.json | 8 + ...eparator-2020-08-12-12-47-49-depcheck.json | 8 + ...ve-stack-2020-08-12-12-47-49-depcheck.json | 8 + ...e-tester-2020-08-12-12-47-49-depcheck.json | 8 + ...er-win32-2020-08-12-12-47-49-depcheck.json | 8 + ...ive-text-2020-08-12-12-47-49-depcheck.json | 8 + ...e-tokens-2020-08-12-12-47-49-depcheck.json | 8 + ...e-tokens-2020-08-12-23-43-57-depcheck.json | 8 + ...se-slots-2020-08-12-12-47-49-depcheck.json | 8 + ...-styling-2020-08-12-12-47-49-depcheck.json | 8 + ...mposable-2020-08-12-12-47-49-depcheck.json | 8 + ...mposable-2020-08-12-23-43-57-depcheck.json | 8 + ...-compose-2020-08-12-12-47-49-depcheck.json | 8 + ...settings-2020-08-12-12-47-49-depcheck.json | 8 + ...settings-2020-08-12-23-43-57-depcheck.json | 8 + ...n-tokens-2020-08-12-12-47-49-depcheck.json | 8 + ...n-tokens-2020-08-12-23-43-57-depcheck.json | 8 + ...le-merge-2020-08-12-12-47-49-depcheck.json | 8 + ...registry-2020-08-12-12-47-49-depcheck.json | 8 + ...settings-2020-08-12-12-47-49-depcheck.json | 8 + ...settings-2020-08-12-23-43-57-depcheck.json | 8 + ...ylesheet-2020-08-12-12-47-49-depcheck.json | 8 + ...ylesheet-2020-08-12-23-43-57-depcheck.json | 8 + ...ing-ramp-2020-08-12-12-47-49-depcheck.json | 8 + ...ing-ramp-2020-08-12-23-43-57-depcheck.json | 8 + ...t-native-2020-08-12-12-47-49-depcheck.json | 8 + lage.config.js | 3 +- package.json | 1 + packages/components/Button/package.json | 1 + packages/components/Callout/package.json | 2 +- packages/components/Checkbox/package.json | 2 +- .../components/ContextualMenu/package.json | 2 +- .../components/FocusTrapZone/package.json | 3 +- packages/components/Link/package.json | 1 + packages/components/Persona/package.json | 1 + packages/components/PersonaCoin/package.json | 1 + packages/components/Pressable/package.json | 2 +- packages/components/RadioGroup/package.json | 1 + packages/components/Separator/package.json | 1 + packages/components/Stack/package.json | 1 + packages/components/text/package.json | 2 + packages/experimental/Button/package.json | 3 + packages/experimental/Stack/package.json | 3 + packages/experimental/Text/package.json | 5 +- .../experimental/composition/package.json | 9 +- .../experimental-framework/package.json | 2 +- packages/experimental/use-slots/package.json | 12 +- .../experimental/use-styling/package.json | 4 +- .../foundation-composable/package.json | 1 + .../framework/foundation-compose/package.json | 15 +- .../foundation-settings/package.json | 1 + .../framework/foundation-tokens/package.json | 1 + .../framework/immutable-merge/package.json | 1 + packages/framework/memo-cache/package.json | 1 + .../framework/theme-registry/package.json | 6 +- .../framework/themed-settings/package.json | 1 + .../framework/themed-stylesheet/package.json | 1 + packages/framework/theming-ramp/package.json | 1 + .../theming-react-native/package.json | 6 +- packages/libraries/core/package.json | 14 +- packages/libraries/framework/package.json | 1 + packages/utils/adapters/package.json | 1 + packages/utils/build-tools/just.config.js | 2 + packages/utils/build-tools/package.json | 7 +- packages/utils/interactive-hooks/package.json | 1 + packages/utils/tokens/package.json | 1 + prettier.config.js | 4 +- scripts/just.config.js | 3 + scripts/package.json | 3 + scripts/tasks/depcheck.js | 63 ++++++++ yarn.lock | 138 ++++++++++++++++-- 117 files changed, 918 insertions(+), 316 deletions(-) create mode 100644 .vscode/extensions.json delete mode 100644 apps/win32/react-native.config.js create mode 100644 change/@fluentui-react-native-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-adapters-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-adapters-2020-08-12-23-43-57-depcheck.json create mode 100644 change/@fluentui-react-native-button-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-callout-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-checkbox-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-composition-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-contextual-menu-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-experimental-framework-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-focus-trap-zone-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-immutable-merge-2020-08-12-23-43-57-depcheck.json create mode 100644 change/@fluentui-react-native-interactive-hooks-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-interactive-hooks-2020-08-12-23-43-57-depcheck.json create mode 100644 change/@fluentui-react-native-link-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-memo-cache-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-memo-cache-2020-08-12-23-43-57-depcheck.json create mode 100644 change/@fluentui-react-native-persona-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-persona-coin-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-pressable-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-radio-group-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-separator-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-stack-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-tester-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-tester-win32-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-text-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-tokens-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-tokens-2020-08-12-23-43-57-depcheck.json create mode 100644 change/@fluentui-react-native-use-slots-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@fluentui-react-native-use-styling-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@uifabricshared-foundation-composable-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@uifabricshared-foundation-composable-2020-08-12-23-43-57-depcheck.json create mode 100644 change/@uifabricshared-foundation-compose-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@uifabricshared-foundation-settings-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@uifabricshared-foundation-settings-2020-08-12-23-43-57-depcheck.json create mode 100644 change/@uifabricshared-foundation-tokens-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@uifabricshared-foundation-tokens-2020-08-12-23-43-57-depcheck.json create mode 100644 change/@uifabricshared-immutable-merge-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@uifabricshared-theme-registry-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@uifabricshared-themed-settings-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@uifabricshared-themed-settings-2020-08-12-23-43-57-depcheck.json create mode 100644 change/@uifabricshared-themed-stylesheet-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@uifabricshared-themed-stylesheet-2020-08-12-23-43-57-depcheck.json create mode 100644 change/@uifabricshared-theming-ramp-2020-08-12-12-47-49-depcheck.json create mode 100644 change/@uifabricshared-theming-ramp-2020-08-12-23-43-57-depcheck.json create mode 100644 change/@uifabricshared-theming-react-native-2020-08-12-12-47-49-depcheck.json create mode 100644 scripts/tasks/depcheck.js diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000..0d1349ca19 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 68e80d73e3..8f76279114 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,26 +1,65 @@ { "editor.formatOnSave": true, + "editor.detectIndentation": false, "editor.trimAutoWhitespace": true, "editor.insertSpaces": true, "editor.tabSize": 2, + + "eslint.enable": true, + "eslint.workingDirectories": [{ "mode": "auto" }], // infer working directory based on .eslintrc/package.json location + "files.trimTrailingWhitespace": true, - "json.format.enable": false, - "javascript.preferences.quoteStyle": "single", - "typescript.preferences.quoteStyle": "single", - "[handlebars]": { - "editor.formatOnSave": false - }, "files.associations": { "**/package.json.hbs": "json", "**/*.json.hbs": "jsonc", "**/README.md.hbs": "markdown" }, - "search.exclude": { - "**/node_modules": true, - "**/lib": true - }, "files.exclude": { "**/lib-amd": true, "**/lib-commonjs": true + }, + "files.watcherExclude": { + "**/.git/objects/**": true, + "**/.git/subtree-cache/**": true, + "**/node_modules/**": true, + "**/.hg/store/**": true, + "**/lib": true, + "**/lib-commonjs": true, + "**/lib-amd": true + }, + + "javascript.preferences.quoteStyle": "single", + + "json.format.enable": false, + + "typescript.preferences.quoteStyle": "single", + "typescript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false, + "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false, + "typescript.tsdk": "./node_modules/typescript/lib", + + "search.exclude": { + "**/node_modules": true, + "**/lib": true, + "**/lib-amd": true, + "**/lib-commonjs": true, + "**/dist": true + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescriptreact]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[handlebars]": { + "editor.formatOnSave": false } } diff --git a/apps/fluent-tester/package.json b/apps/fluent-tester/package.json index 5bef5308bd..43e57fa6e5 100644 --- a/apps/fluent-tester/package.json +++ b/apps/fluent-tester/package.json @@ -13,6 +13,7 @@ "just": "fluentui-scripts", "clean": "fluentui-scripts clean", "code-style": "fluentui-scripts code-style", + "depcheck": "fluentui-scripts depcheck", "lint": "fluentui-scripts eslint", "start": "fluentui-scripts metro --server", "test": "fluentui-scripts jest", @@ -21,20 +22,11 @@ "dependencies": { "@fluentui/react-native": ">=0.15.85 <1.0.0", "@fluentui-react-native/stack": ">=0.2.6 <1.0.0", - "@fluentui-react-native/button": ">=0.10.7 <1.0.0", - "@fluentui-react-native/separator": ">=0.4.6 <1.0.0", - "@fluentui-react-native/checkbox": ">=0.5.1 <1.0.0", - "@fluentui-react-native/text": ">=0.6.6 <1.0.0", "@fluentui-react-native/interactive-hooks": ">=0.5.0 <1.0.0", - "@fluentui-react-native/pressable": ">=0.3.83 <1.0.0", - "@fluentui-react-native/focus-trap-zone": ">=0.4.7 <1.0.0", - "@fluentui-react-native/link": ">=0.8.8 <1.0.0", - "@fluentui-react-native/radio-group": ">=0.4.4 <1.0.0", - "@fluentui-react-native/persona-coin": ">=0.3.82 <1.0.0", - "@fluentui-react-native/persona": ">=0.5.79 <1.0.0", - "@fluentui-react-native/contextual-menu": ">=0.3.7 <1.0.0", "@uifabricshared/theming-react-native": ">=0.7.74 <1.0.0", + "@uifabricshared/theme-registry": ">=0.3.68 <1.0.0", "@uifabricshared/themed-stylesheet": ">=0.3.67 <1.0.0", + "@uifabricshared/theming-ramp": ">=0.10.1 <1.0.0", "react-native-svg": "^11.0.0" }, "devDependencies": { diff --git a/apps/fluent-tester/src/RNTester/FabricTester.tsx b/apps/fluent-tester/src/RNTester/FabricTester.tsx index a47072acfb..951669800b 100644 --- a/apps/fluent-tester/src/RNTester/FabricTester.tsx +++ b/apps/fluent-tester/src/RNTester/FabricTester.tsx @@ -1,5 +1,4 @@ -import { StealthButton } from '@fluentui-react-native/button'; -import { Separator } from '@fluentui-react-native/separator'; +import { StealthButton, Separator } from '@fluentui/react-native'; import { useTheme } from '@uifabricshared/theming-react-native'; import * as React from 'react'; import { Picker, ScrollView, View, Text } from 'react-native'; @@ -106,12 +105,11 @@ const Header: React.FunctionComponent<{}> = () => { } export const FabricTester: React.FunctionComponent = (props: IFabricTesterProps) => { - // sort tests alphabetically by name const sortedTestComponents = props.enabledTests.sort((a, b) => a.name.localeCompare(b.name)); const { initialTest } = props; - const initialSelectedTestIndex = sortedTestComponents.findIndex(description => { + const initialSelectedTestIndex = sortedTestComponents.findIndex((description) => { return description.name === initialTest; }); @@ -122,8 +120,8 @@ export const FabricTester: React.FunctionComponent = (props: const TestListSeparator = Separator.customize({ tokens: { color: useTheme().colors.inputBorder, - separatorWidth: 2 - } + separatorWidth: 2, + }, }); return ( @@ -158,4 +156,4 @@ export const FabricTester: React.FunctionComponent = (props: ); -}; \ No newline at end of file +}; diff --git a/apps/fluent-tester/src/RNTester/TestComponents/Button/ButtonFocusTest.tsx b/apps/fluent-tester/src/RNTester/TestComponents/Button/ButtonFocusTest.tsx index 40df60bb78..565c1ced90 100644 --- a/apps/fluent-tester/src/RNTester/TestComponents/Button/ButtonFocusTest.tsx +++ b/apps/fluent-tester/src/RNTester/TestComponents/Button/ButtonFocusTest.tsx @@ -1,4 +1,4 @@ -import { Button } from '@fluentui-react-native/button'; +import { Button } from '@fluentui/react-native'; import { IFocusable } from '@fluentui-react-native/interactive-hooks'; import { Stack } from '@fluentui-react-native/stack'; import * as React from 'react'; @@ -7,7 +7,7 @@ import { stackStyle } from '../Common/styles'; export const ButtonFocusTest: React.FunctionComponent<{}> = () => { const [state, setState] = React.useState({ - focused: false + focused: false, }); const buttonRef = React.useRef(null); @@ -17,7 +17,6 @@ export const ButtonFocusTest: React.FunctionComponent<{}> = () => { const node = findNodeHandle(buttonRef.current); console.log(node); buttonRef.current.focus(); - } }, [state, setState]); @@ -27,4 +26,4 @@ export const ButtonFocusTest: React.FunctionComponent<{}> = () => {