Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Components: Invert tsconfig to be exclude-based #43534

Merged
merged 2 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/components/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ component-family-name/

Given a component folder (e.g. `packages/components/src/unit-control`):

1. Add the folder to `tsconfig.json`, if it isn’t already.
1. Remove the folder from the exclude list in `tsconfig.json`, if it isn’t already.
2. Remove any `// @ts-nocheck` comments in the folder, if any.
3. Rename `*.js{x}` files to `*.ts{x}` (except stories and unit tests).
4. Run `npm run dev` and take note of all the errors (your IDE should also flag them).
Expand All @@ -504,7 +504,7 @@ Given a component folder (e.g. `packages/components/src/unit-control`):
}
```

3. Add the folders to the `tsconfig.json` file.
3. Remove the folders from the exclude list in the `tsconfig.json` file.
4. If you’re still getting errors about a component’s props, the easiest way is to slightly refactor this component and perform the props destructuring inside the component’s body (as opposed as in the function signature) — this is to prevent TypeScript from inferring the types of these props.
5. Continue with the refactor of the current component (and take care of the refactor of the dependent components at a later stage).
6. Create a new `types.ts` file.
Expand Down
127 changes: 51 additions & 76 deletions packages/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,88 +30,63 @@
{ "path": "../react-i18n" },
{ "path": "../warning" }
],
"include": [
"src/__next/**/*",
"src/animate/**/*",
"src/base-control/**/*",
"src/base-field/**/*",
"src/border-box-control/**/*",
"src/border-control/**/*",
"src/button/**/*",
"src/button-group/**/*",
"src/card/**/*",
"src/checkbox-control/**/*",
"src/circular-option-picker/**/*",
"src/color-indicator/**/*",
"src/color-palette/**/*",
"src/color-picker/**/*",
"src/confirm-dialog/**/*",
"src/dashicon/**/*",
"src/date-time/**/*",
"src/disabled/**/*",
"src/divider/**/*",
"src/draggable/**/*",
"src/dropdown/**/*",
"src/dropdown-menu/**/*",
"src/elevation/**/*",
"src/external-link/**/*",
"src/flex/**/*",
"src/form-group/**/*",
"src/form-toggle/**/*",
"src/form-token-field/**/*",
"src/grid/**/*",
"src/h-stack/**/*",
"src/heading/**/*",
"src/higher-order/with-focus-outside/**/*",
"src/icon/**/*",
"src/input-control/**/*",
"src/item-group/**/*",
"src/menu-item/**/*",
"src/menu-group/**/*",
"src/modal/**/*",
"src/navigable-container/**/*",
"src/navigator/**/*",
"src/number-control/**/*",
"src/placeholder/**/*",
"src/popover/**/*",
"src/radio-control/**/*",
"src/range-control/**/*",
"src/resizable-box/**/*",
"src/scroll-lock/**/*",
"src/scrollable/**/*",
"src/select-control/**/*",
"src/shortcut/**/*",
"src/slot-fill/**/*",
"src/style-provider/**/*",
"src/spacer/**/*",
"src/spinner/**/*",
"src/surface/**/*",
"src/text/**/*",
"src/text-control/**/*",
"src/text-highlight/**/*",
"src/textarea-control/**/*",
"src/tip/**/*",
"src/toggle-group-control/**/*",
"src/tools-panel/**/*",
"src/tooltip/**/*",
"src/tree-select/**/*",
"src/truncate/**/*",
"src/ui/**/*",
"src/unit-control/**/*",
"src/utils/**/*",
"src/v-stack/**/*",
"src/view/**/*",
"src/visually-hidden/**/*",
"src/z-stack/**/*"
],
"include": [ "src/**/*" ],
"exclude": [
"src/**/*.android.js",
"src/**/*.ios.js",
"src/**/*.native.js",
"src/**/react-native-*",
"src/**/stories/**.js", // only exclude js files, tsx files should be checked
"src/**/test/**.js", // only exclude js files, ts{x} files should be checked
"src/ui/__storybook-utils",
"src/ui/font-size-control"
"src/index.js",
"src/alignment-matrix-control",
"src/angle-picker-control",
"src/autocomplete",
"src/box-control",
"src/clipboard-button",
"src/color-list-picker",
"src/combobox-control",
"src/custom-gradient-picker",
"src/custom-select-control",
"src/dimension-control",
"src/drop-zone",
"src/duotone-picker",
"src/focal-point-picker",
"src/focusable-iframe",
"src/font-size-picker",
"src/form-file-upload",
"src/gradient-picker",
"src/guide",
"src/higher-order/navigate-regions",
"src/higher-order/with-constrained-tabbing",
"src/higher-order/with-fallback-styles",
"src/higher-order/with-filters",
"src/higher-order/with-focus-return",
"src/higher-order/with-spoken-messages",
"src/higher-order/with-notices",
"src/isolated-event-container",
"src/keyboard-shortcuts",
"src/menu-items-choice",
"src/navigation",
"src/notice",
"src/palette-edit",
"src/panel",
"src/query-controls",
"src/radio",
"src/radio-group",
"src/responsive-wrapper",
"src/sandbox",
"src/search-control",
"src/snackbar",
"src/tab-panel",
"src/toggle-control",
"src/toolbar",
"src/toolbar-button",
"src/toolbar-context",
"src/toolbar-dropdown-menu",
"src/toolbar-group",
"src/toolbar-item",
"src/tree-grid",
"src/ui/__storybook-utils"
]
}