Enforce Strict `@types` Dependencies (#37351)

This commit is contained in:
Christopher Allford 2023-03-23 18:02:20 -07:00 committed by GitHub
parent 3d614cd862
commit 67cde87fd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
122 changed files with 3617 additions and 3622 deletions

View File

@ -1,6 +1,6 @@
{
"dev": true,
"filter": "^(?:config|react|react-dom|eslint|typescript|@typescript-eslint|@types/react|@wordpress|@types/wordpress__components|postcss).*$",
"filter": "^(?:config|react|react-dom|eslint|typescript|@typescript-eslint|@types/react|@wordpress|@types/wordpress__components|postcss|@types/node).*$",
"indent": "\t",
"overrides": true,
"peer": true,
@ -59,7 +59,7 @@
"packages": [
"**"
],
"pinVersion": "^4.8.3"
"pinVersion": "^4.9.5"
},
{
"dependencies": [
@ -154,6 +154,15 @@
"**"
],
"pinVersion": "^8.4.7"
},
{
"dependencies": [
"@types/node"
],
"packages": [
"**"
],
"pinVersion": "^16.18.18"
}
]
}

View File

@ -3,6 +3,10 @@
"title": "WooCommerce Monorepo",
"description": "Monorepo for the WooCommerce ecosystem",
"homepage": "https://woocommerce.com/",
"engines": {
"node": "^16.13.1",
"pnpm": "^7.13.3"
},
"private": true,
"repository": {
"type": "git",
@ -25,41 +29,41 @@
"sync-dependencies": "pnpm exec syncpack -- fix-mismatches"
},
"devDependencies": {
"@babel/preset-env": "^7.16.11",
"@babel/runtime": "^7.17.2",
"@types/node": "14.14.33",
"@babel/preset-env": "^7.20.2",
"@babel/runtime": "^7.21.0",
"@types/node": "^16.18.18",
"@woocommerce/eslint-plugin": "workspace:*",
"@wordpress/data": "wp-6.0",
"@wordpress/eslint-plugin": "^11.1.0",
"@wordpress/prettier-config": "^1.1.1",
"babel-loader": "^8.2.3",
"@wordpress/prettier-config": "^1.4.0",
"babel-loader": "^8.3.0",
"chalk": "^4.1.2",
"copy-webpack-plugin": "^10.2.4",
"core-js": "^3.21.1",
"css-loader": "^6.7.0",
"glob": "^7.2.0",
"core-js": "^3.29.1",
"css-loader": "^6.7.3",
"glob": "^7.2.3",
"husky": "^7.0.4",
"jest": "^27.3.1",
"lint-staged": "^12.3.7",
"jest": "^27.5.1",
"lint-staged": "^12.5.0",
"mkdirp": "^1.0.4",
"moment": "^2.29.1",
"moment": "^2.29.4",
"node-stream-zip": "^1.15.0",
"postcss-loader": "^4.3.0",
"prettier": "npm:wp-prettier@^2.2.1-beta-1",
"regenerator-runtime": "^0.13.9",
"prettier": "npm:wp-prettier@^2.6.2",
"regenerator-runtime": "^0.13.11",
"request": "^2.88.2",
"sass": "^1.49.9",
"sass-loader": "^10.2.1",
"sass": "^1.59.3",
"sass-loader": "^10.4.1",
"syncpack": "^9.8.4",
"turbo": "^1.8.3",
"typescript": "^4.8.3",
"turbo": "^1.8.5",
"typescript": "^4.9.5",
"url-loader": "^1.1.2",
"webpack": "^5.70.0"
"webpack": "^5.76.2"
},
"dependencies": {
"@babel/core": "7.12.9",
"@wordpress/babel-plugin-import-jsx-pragma": "^3.1.0",
"@wordpress/babel-preset-default": "^6.4.1",
"@wordpress/babel-plugin-import-jsx-pragma": "^3.2.0",
"@wordpress/babel-preset-default": "^6.17.0",
"lodash": "^4.17.21",
"wp-textdomain": "1.0.1"
},

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -50,7 +50,7 @@
"jest-mock-extended": "^1.0.18",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3"
"typescript": "^4.9.5"
},
"publishConfig": {
"access": "public"

View File

@ -2,6 +2,10 @@
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -56,7 +56,7 @@
"react-dom": "^17.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3",
"typescript": "^4.9.5",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
},

View File

@ -1,6 +1,10 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -5,6 +5,10 @@
"outDir": "build-module",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
"declarationDir": "./build-types",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -50,7 +50,7 @@
"devDependencies": {
"@types/create-hmac": "1.1.0",
"@types/jest": "^27.4.1",
"@types/node": "13.13.5",
"@types/node": "^16.18.18",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"@woocommerce/eslint-plugin": "workspace:*",
@ -58,7 +58,7 @@
"eslint": "^8.32.0",
"jest": "^27",
"ts-jest": "^27",
"typescript": "^4.8.3"
"typescript": "^4.9.5"
},
"publishConfig": {
"access": "public"

View File

@ -4,7 +4,11 @@
"types": [ "node", "jest", "axios", "create-hmac" ],
"rootDir": "src",
"outDir": "dist",
"target": "es5"
"target": "es5",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
},
"include": [ "src/" ]
}

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -1,4 +1,4 @@
{
"rootDir": "./src",
"preset": "../../internal-js-tests/jest.config.js"
"preset": "../node_modules/@woocommerce/internal-js-tests/jest-preset.js"
}

View File

@ -128,6 +128,7 @@
"@types/wordpress__viewport": "^2.5.4",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-style-build": "workspace:*",
"@woocommerce/internal-js-tests": "workspace:*",
"@wordpress/browserslist-config": "wp-6.0",
"@wordpress/scripts": "^12.6.1",
"concurrently": "^7.0.0",
@ -141,7 +142,7 @@
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3",
"typescript": "^4.9.5",
"uuid": "^8.3.0",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"

View File

@ -27,7 +27,7 @@ type BaseTreeProps = {
* ancestors and its descendants are also selected. If it's false
* only the clicked item is selected.
*
* @param value The selection
* @param value The selection
*/
onSelect?( value: Item | Item[] ): void;
/**
@ -36,7 +36,7 @@ type BaseTreeProps = {
* are also unselected. If it's false only the clicked item is
* unselected.
*
* @param value The unselection
* @param value The unselection
*/
onRemove?( value: Item | Item[] ): void;
/**
@ -48,8 +48,8 @@ type BaseTreeProps = {
* shouldItemBeHighlighted={ isFirstChild }
* />
*
* @param item The current linked tree item, useful to
* traverse the entire linked tree from this item.
* @param item The current linked tree item, useful to
* traverse the entire linked tree from this item.
*
* @see {@link LinkedTree}
*/
@ -66,7 +66,8 @@ export type TreeProps = BaseTreeProps &
> & {
level?: number;
items: LinkedTree[];
/** It gives a way to render a different Element as the
/**
* It gives a way to render a different Element as the
* tree item label.
*
* @example
@ -74,7 +75,7 @@ export type TreeProps = BaseTreeProps &
* getItemLabel={ ( item ) => <span>${ item.data.label }</span> }
* />
*
* @param item The current rendering tree item
* @param item The current rendering tree item
*
* @see {@link LinkedTree}
*/

View File

@ -18,7 +18,7 @@ export type FormErrors< Values > = {
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type FormContext< Values extends Record< string, any > > = {
export type FormContextType< Values extends Record< string, any > > = {
values: Values;
errors: FormErrors< Values >;
isDirty: boolean;
@ -51,14 +51,16 @@ export type FormContext< Values extends Record< string, any > > = {
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const FormContext = createContext< FormContext< any > >(
export const FormContext: React.Context< FormContextType< any > > =
// eslint-disable-next-line @typescript-eslint/no-explicit-any
{} as FormContext< any >
);
createContext< FormContextType< any > >(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
{} as FormContextType< any >
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function useFormContext< Values extends Record< string, any > >() {
const formContext = useContext< FormContext< Values > >( FormContext );
const formContext = useContext< FormContextType< Values > >( FormContext );
return formContext;
}

View File

@ -10,7 +10,7 @@ import { TextControl } from '@wordpress/components';
* Internal dependencies
*/
import { Form, useFormContext } from '../';
import type { FormContext } from '../';
import type { FormContextType } from '../';
import { DateTimePickerControl } from '../../date-time-picker-control';
const TestInputWithContext = () => {
@ -44,7 +44,7 @@ describe( 'Form', () => {
>
{ ( {
handleSubmit,
}: FormContext< Record< string, string > > ) => {
}: FormContextType< Record< string, string > > ) => {
return <button onClick={ handleSubmit }>Submit</button>;
} }
</Form>
@ -71,7 +71,7 @@ describe( 'Form', () => {
onChange={ mockOnChange }
validate={ () => ( {} ) }
>
{ ( { setValue }: FormContext< Record< string, string > > ) => {
{ ( { setValue }: FormContextType< Record< string, string > > ) => {
return (
<button
onClick={ () => {
@ -103,7 +103,7 @@ describe( 'Form', () => {
<Form onSubmit={ mockOnSubmit } validate={ () => ( {} ) }>
{ ( {
handleSubmit,
}: FormContext< Record< string, string > > ) => {
}: FormContextType< Record< string, string > > ) => {
return <button onClick={ handleSubmit }>Submit</button>;
} }
</Form>
@ -124,7 +124,7 @@ describe( 'Form', () => {
const { queryByText } = render(
<Form onChange={ mockOnChange } validate={ () => ( {} ) }>
{ ( { setValue }: FormContext< Record< string, string > > ) => {
{ ( { setValue }: FormContextType< Record< string, string > > ) => {
return (
<button
onClick={ () => {
@ -156,7 +156,7 @@ describe( 'Form', () => {
{ ( {
setValue,
getInputProps,
}: FormContext< Record< string, string > > ) => {
}: FormContextType< Record< string, string > > ) => {
return (
<TextControl
label={ 'First Name' }
@ -206,7 +206,7 @@ describe( 'Form', () => {
{ ( {
setValue,
getInputProps,
}: FormContext< Record< string, string > > ) => {
}: FormContextType< Record< string, string > > ) => {
return (
<TextControl
label={ 'First Name' }
@ -243,7 +243,7 @@ describe( 'Form', () => {
{ ( {
setValue,
getInputProps,
}: FormContext< Record< string, string > > ) => {
}: FormContextType< Record< string, string > > ) => {
return (
<TextControl
label={ 'First Name' }
@ -293,7 +293,7 @@ describe( 'Form', () => {
{ ( {
setValue,
getInputProps,
}: FormContext< Record< string, string > > ) => {
}: FormContextType< Record< string, string > > ) => {
return (
<TextControl
label={ 'First Name' }
@ -329,7 +329,7 @@ describe( 'Form', () => {
<Form onChanges={ mockOnChanges } validate={ () => ( {} ) }>
{ ( {
setValues,
}: FormContext< Record< string, string > > ) => {
}: FormContextType< Record< string, string > > ) => {
return (
<button
onClick={ () => {
@ -379,7 +379,7 @@ describe( 'Form', () => {
<Form onChanges={ mockOnChanges } validate={ validate }>
{ ( {
setValues,
}: FormContext< Record< string, string > > ) => {
}: FormContextType< Record< string, string > > ) => {
return (
<button
onClick={ () => {
@ -428,7 +428,7 @@ describe( 'Form', () => {
const { container, queryByText } = render(
<Form< TestData > onChange={ mockOnChange } validate={ validate }>
{ ( { getInputProps, values }: FormContext< TestData > ) => {
{ ( { getInputProps, values }: FormContextType< TestData > ) => {
return (
<DateTimePickerControl
label={ 'Date' }

View File

@ -16,7 +16,7 @@ export { default as EmptyContent } from './empty-content';
export { default as Flag } from './flag';
export { Form, useFormContext } from './form';
export { FormSection } from './form-section';
export type { FormContext, FormRef, FormErrors } from './form';
export type { FormContext, FormContextType, FormRef, FormErrors } from './form';
export { default as FilterPicker } from './filter-picker';
export { H, Section } from './section';
export { ImageGallery, ImageGalleryItem } from './image-gallery';

View File

@ -8,6 +8,6 @@ import { createContext } from '@wordpress/element';
*
* See https://medium.com/@Heydon/managing-heading-levels-in-design-systems-18be9a746fa3
*/
const Level = createContext( 2 );
const Level: React.Context< number > = createContext( 2 );
export { Level };

View File

@ -43,7 +43,7 @@ export type SortableProps = {
const THROTTLE_TIME = 16;
export const SortableContext = createContext( {} );
export const SortableContext: React.Context< object > = createContext( {} );
export const Sortable = ( {
children,

View File

@ -15,19 +15,19 @@ import { BACKSPACE } from './constants';
* The Control Component renders a search input and also the Tags.
* It also triggers the setExpand for expanding the options tree on click.
*
* @param {Object} props Component props
* @param {Array} props.tags Array of tags
* @param {string} props.instanceId Id of the component
* @param {string} props.placeholder Placeholder of the search input
* @param {boolean} props.isExpanded True if the tree is expanded
* @param {boolean} props.alwaysShowPlaceholder Will always show placeholder (default: false)
* @param {boolean} props.disabled True if the component is disabled
* @param {number} props.maxVisibleTags The maximum number of tags to show. Undefined, 0 or less than 0 evaluates to "Show All".
* @param {string} props.value The current input value
* @param {Function} props.onFocus On Focus Callback
* @param {Function} props.onTagsChange Callback when the Tags change
* @param {Function} props.onInputChange Callback when the Input value changes
* @param {Function} [props.onControlClick] Callback when clicking on the control.
* @param {Object} props Component props
* @param {Array} props.tags Array of tags
* @param {string} props.instanceId Id of the component
* @param {string} props.placeholder Placeholder of the search input
* @param {boolean} props.isExpanded True if the tree is expanded
* @param {boolean} props.alwaysShowPlaceholder Will always show placeholder (default: false)
* @param {boolean} props.disabled True if the component is disabled
* @param {number} props.maxVisibleTags The maximum number of tags to show. Undefined, 0 or less than 0 evaluates to "Show All".
* @param {string} props.value The current input value
* @param {Function} props.onFocus On Focus Callback
* @param {Function} props.onTagsChange Callback when the Tags change
* @param {Function} props.onInputChange Callback when the Input value changes
* @param {Function} [props.onControlClick] Callback when clicking on the control.
* @return {JSX.Element} The rendered component
*/
const Control = forwardRef(

View File

@ -70,7 +70,7 @@ import { ARROW_DOWN, ARROW_UP, ENTER, ESCAPE, ROOT_VALUE } from './constants';
* @param {number} [props.maxVisibleTags] The maximum number of tags to show. Undefined, 0 or less than 0 evaluates to "Show All".
* @param {Function} [props.onChange] Callback when the selector changes
* @param {(visible: boolean) => void} [props.onDropdownVisibilityChange] Callback when the visibility of the dropdown options is changed.
* @param {Function} [props.onInputChange] Callback when the selector changes
* @param {Function} [props.onInputChange] Callback when the selector changes
* @return {JSX.Element} The component
*/
const TreeSelectControl = ( {

View File

@ -64,7 +64,7 @@ function createOrderedChildren< T = Fill.Props, S = Record< string, unknown > >(
order: number,
props: T,
injectProps?: S
) {
): React.ReactElement {
const { children: childrenToRender, props: propsToRender } =
getChildrenAndProps( children, order, props, injectProps );
return cloneElement( childrenToRender, propsToRender );

View File

@ -1,6 +1,10 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -5,6 +5,11 @@
"outDir": "build-module",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
"declarationDir": "./build-types",
"composite": true,
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -1,4 +1,4 @@
{
"rootDir": "./src",
"preset": "../../internal-js-tests/jest.config.js"
"preset": "../node_modules/@woocommerce/internal-js-tests/jest-preset.js"
}

View File

@ -26,6 +26,7 @@
"types": "build-types",
"react-native": "src/index",
"dependencies": {
"@types/node": "^16.18.18",
"browser-filesaver": "^1.1.1",
"moment": "^2.29.1"
},
@ -50,13 +51,14 @@
"@babel/core": "^7.17.5",
"@types/jest": "^27.4.1",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-js-tests": "workspace:*",
"eslint": "^8.32.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"concurrently": "^7.0.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3"
"typescript": "^4.9.5"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -1,6 +1,10 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -5,6 +5,11 @@
"outDir": "build-module",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
"declarationDir": "./build-types",
"composite": true,
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -1,4 +1,4 @@
{
"rootDir": "./src",
"preset": "../../internal-js-tests/jest.config.js"
"preset": "../node_modules/@woocommerce/internal-js-tests/jest-preset.js"
}

View File

@ -54,13 +54,14 @@
"@babel/core": "^7.17.5",
"@types/jest": "^27.4.1",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-js-tests": "workspace:*",
"eslint": "^8.32.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"concurrently": "^7.0.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3"
"typescript": "^4.9.5"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -2,6 +2,10 @@
"extends": "../tsconfig-cjs",
"compilerOptions": {
"declaration": true,
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -5,6 +5,10 @@
"outDir": "build-module",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
"declarationDir": "./build-types",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -1,4 +1,4 @@
{
"rootDir": "./src",
"preset": "../../internal-js-tests/jest.config.js"
"preset": "../node_modules/@woocommerce/internal-js-tests/jest-preset.js"
}

View File

@ -52,6 +52,7 @@
"@woocommerce/internal-style-build": "workspace:*",
"@woocommerce/navigation": "workspace:*",
"@woocommerce/tracks": "workspace:*",
"@woocommerce/internal-js-tests": "workspace:*",
"@wordpress/browserslist-config": "wp-6.0",
"concurrently": "^7.0.0",
"css-loader": "^3.6.0",
@ -63,7 +64,7 @@
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3",
"typescript": "^4.9.5",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
},

View File

@ -1,6 +1,10 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -5,6 +5,10 @@
"outDir": "build-module",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
"declarationDir": "./build-types",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -1,4 +1,4 @@
{
"rootDir": "./src",
"preset": "../../internal-js-tests/jest.config.js"
"preset": "../node_modules/@woocommerce/internal-js-tests/jest-preset.js"
}

View File

@ -59,11 +59,13 @@
"@types/md5": "^2.3.2",
"@types/qs": "^6.9.7",
"@types/react": "^17.0.2",
"@types/node": "^16.18.18",
"@types/wordpress__compose": "^4.0.1",
"@types/wordpress__core-data": "^2.4.5",
"@types/wordpress__data": "^6.0.0",
"@types/wordpress__data-controls": "^2.2.0",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-js-tests": "workspace:*",
"eslint": "^8.32.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
@ -71,7 +73,7 @@
"redux": "^4.1.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3"
"typescript": "^4.9.5"
},
"peerDependencies": {
"@wordpress/core-data": "wp-6.0",

View File

@ -1,6 +1,10 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -5,6 +5,10 @@
"outDir": "build-module",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
"declarationDir": "./build-types",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -1,4 +1,4 @@
{
"rootDir": "./src",
"preset": "../../internal-js-tests/jest.config.js"
"preset": "../node_modules/@woocommerce/internal-js-tests/jest-preset.js"
}

View File

@ -35,10 +35,12 @@
},
"devDependencies": {
"@babel/core": "^7.17.5",
"@types/node": "^16.18.18",
"@types/jest": "^27.4.1",
"@types/lodash": "^4.14.182",
"@types/qs": "^6.9.7",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-js-tests": "workspace:*",
"d3-time-format": "^2.3.0",
"eslint": "^8.32.0",
"jest": "^27.5.1",
@ -46,7 +48,7 @@
"concurrently": "^7.0.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3"
"typescript": "^4.9.5"
},
"peerDependencies": {
"lodash": "^4.17.0"

View File

@ -2,7 +2,7 @@
* External dependencies
*/
import moment from 'moment';
import 'moment-timezone';
import momentTz from 'moment-timezone';
import { find, memoize } from 'lodash';
import { __ } from '@wordpress/i18n';
import { parse } from 'qs';
@ -181,7 +181,7 @@ export function getStoreTimeZoneMoment() {
return moment().utcOffset( window.wcSettings.timeZone );
}
return moment().tz( window.wcSettings.timeZone );
return ( moment() as momentTz.Moment ).tz( window.wcSettings.timeZone );
}
/**

View File

@ -1,6 +1,10 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -5,6 +5,10 @@
"outDir": "build-module",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
"declarationDir": "./build-types",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -35,7 +35,7 @@
"jest-cli": "^27.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3",
"typescript": "^4.9.5",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
},

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -52,7 +52,7 @@
"jest-cli": "^27.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3"
"typescript": "^4.9.5"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -1,4 +1,4 @@
{
"rootDir": "./src",
"preset": "../../internal-js-tests/jest.config.js"
"preset": "../node_modules/@woocommerce/internal-js-tests/jest-preset.js"
}

View File

@ -62,6 +62,7 @@
"@types/wordpress__components": "^19.10.3",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-style-build": "workspace:*",
"@woocommerce/internal-js-tests": "workspace:*",
"@wordpress/browserslist-config": "wp-6.0",
"concurrently": "^7.0.0",
"css-loader": "^3.6.0",
@ -73,7 +74,7 @@
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3",
"typescript": "^4.9.5",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
},

View File

@ -1,6 +1,10 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -6,6 +6,10 @@
"target": "es2019",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
"declarationDir": "./build-types",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -1,4 +1,4 @@
{
"rootDir": "./src",
"preset": "../../internal-js-tests/jest.config.js"
"preset": "../node_modules/@woocommerce/internal-js-tests/jest-preset.js"
}

View File

@ -41,17 +41,18 @@
"@babel/core": "^7.17.5",
"@types/cookie": "^0.4.1",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.21",
"@types/node": "^16.18.18",
"@types/qs": "^6.9.7",
"@types/react": "^17.0.2",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-js-tests": "workspace:*",
"eslint": "^8.32.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"concurrently": "^7.0.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3"
"typescript": "^4.9.5"
},
"scripts": {
"turbo:build": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",

View File

@ -1,6 +1,10 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -5,6 +5,10 @@
"outDir": "build-module",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
"declarationDir": "./build-types",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
},
}

View File

@ -46,7 +46,8 @@
"resize-observer-polyfill": "1.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3"
"babel-jest": "^27.5.1",
"typescript": "^4.9.5"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -1,6 +1,10 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -2,6 +2,11 @@
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build-module"
"outDir": "build-module",
"composite": true,
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -45,7 +45,7 @@
"jest-cli": "^27.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3",
"typescript": "^4.9.5",
"webpack": "^5.70.0"
},
"lint-staged": {

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -1,4 +1,4 @@
{
"rootDir": "./src",
"preset": "../../internal-js-tests/jest.config.js"
"preset": "../node_modules/@woocommerce/internal-js-tests/jest-preset.js"
}

View File

@ -64,13 +64,14 @@
"@types/jest": "^27.4.1",
"@types/qs": "^6.9.7",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-js-tests": "workspace:*",
"eslint": "^8.32.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"concurrently": "^7.0.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3"
"typescript": "^4.9.5"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -1,6 +1,10 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -5,6 +5,10 @@
"outDir": "build-module",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
"declarationDir": "./build-types",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -63,7 +63,7 @@
"redux": "^4.2.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3"
"typescript": "^4.9.5"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -1,6 +1,10 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -5,6 +5,10 @@
"outDir": "build-module",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
"declarationDir": "./build-types",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -1,4 +1,4 @@
{
"rootDir": "./src",
"preset": "../../internal-js-tests/jest.config.js"
"preset": "../node_modules/@woocommerce/internal-js-tests/jest-preset.js"
}

View File

@ -50,13 +50,14 @@
"@types/jest": "^27.4.1",
"@types/lodash": "^4.14.184",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-js-tests": "workspace:*",
"eslint": "^8.32.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"concurrently": "^7.0.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3"
"typescript": "^4.9.5"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -2,6 +2,10 @@
"extends": "../tsconfig-cjs",
"compilerOptions": {
"declaration": true,
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -5,6 +5,10 @@
"outDir": "build-module",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
"declarationDir": "./build-types",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -56,7 +56,7 @@
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3",
"typescript": "^4.9.5",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
},

View File

@ -1,6 +1,10 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -5,6 +5,10 @@
"outDir": "build-module",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
"declarationDir": "./build-types",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -1,4 +1,4 @@
{
"rootDir": "./src",
"preset": "../../internal-js-tests/jest.config.js"
"preset": "../node_modules/@woocommerce/internal-js-tests/jest-preset.js"
}

View File

@ -80,6 +80,7 @@
"@types/wordpress__plugins": "^3.0.0",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-style-build": "workspace:*",
"@woocommerce/internal-js-tests": "workspace:*",
"@wordpress/block-editor": "^9.8.0",
"@wordpress/browserslist-config": "wp-6.0",
"concurrently": "^7.0.0",
@ -95,7 +96,7 @@
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3",
"typescript": "^4.9.5",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
},

View File

@ -3,7 +3,7 @@
*/
import { ReactElement, Component } from 'react';
import { render, fireEvent } from '@testing-library/react';
import { Form, FormContext } from '@woocommerce/components';
import { Form, FormContextType } from '@woocommerce/components';
import { Product, ProductCategory } from '@woocommerce/data';
import { createElement } from '@wordpress/element';
@ -114,7 +114,7 @@ describe( 'CategoryField', () => {
it( 'should render a dropdown select control', () => {
const { queryByText } = render(
<Form initialValues={ { categories: [] } }>
{ ( { getInputProps }: FormContext< Product > ) => (
{ ( { getInputProps }: FormContextType< Product > ) => (
<CategoryField
label="Categories"
placeholder="Search or create category…"
@ -138,7 +138,7 @@ describe( 'CategoryField', () => {
],
} }
>
{ ( { getInputProps }: FormContext< Product > ) => (
{ ( { getInputProps }: FormContextType< Product > ) => (
<CategoryField
label="Categories"
placeholder="Search or create category…"
@ -175,7 +175,7 @@ describe( 'CategoryField', () => {
categories: [],
} }
>
{ ( { getInputProps }: FormContext< Product > ) => (
{ ( { getInputProps }: FormContextType< Product > ) => (
<CategoryField
label="Categories"
placeholder="Search or create category…"
@ -210,7 +210,7 @@ describe( 'CategoryField', () => {
categories: [ mockCategoryList[ 2 ] ],
} }
>
{ ( { getInputProps }: FormContext< Product > ) => (
{ ( { getInputProps }: FormContextType< Product > ) => (
<CategoryField
label="Categories"
placeholder="Search or create category…"
@ -238,7 +238,7 @@ describe( 'CategoryField', () => {
categories: [ mockCategoryList[ 2 ] ],
} }
>
{ ( { getInputProps }: FormContext< Product > ) => (
{ ( { getInputProps }: FormContextType< Product > ) => (
<CategoryField
label="Categories"
placeholder="Search or create category…"
@ -266,7 +266,7 @@ describe( 'CategoryField', () => {
categories: [ mockCategoryList[ 2 ] ],
} }
>
{ ( { getInputProps }: FormContext< Product > ) => (
{ ( { getInputProps }: FormContextType< Product > ) => (
<CategoryField
label="Categories"
placeholder="Search or create category…"
@ -295,7 +295,7 @@ describe( 'CategoryField', () => {
categories: [ mockCategoryList[ 2 ] ],
} }
>
{ ( { getInputProps }: FormContext< Product > ) => (
{ ( { getInputProps }: FormContextType< Product > ) => (
<CategoryField
label="Categories"
placeholder="Search or create category…"

View File

@ -7,8 +7,8 @@ import { useEffect, useState } from '@wordpress/element';
/**
* Signals that product saving is locked.
*
* @param lockName The namespace used to lock the product saving if validation fails.
* @param validate The validator function.
* @param lockName The namespace used to lock the product saving if validation fails.
* @param validate The validator function.
*/
export function useValidation(
lockName: string,

View File

@ -64,7 +64,7 @@ function createOrderedChildren< T = Fill.Props, S = Record< string, unknown > >(
order: number,
props: T,
injectProps?: S
) {
): React.ReactElement {
const { children: childrenToRender, props: propsToRender } =
getChildrenAndProps( children, order, props, injectProps );
return cloneElement( childrenToRender, propsToRender );

View File

@ -11,7 +11,7 @@ import { AUTO_DRAFT_NAME } from './constants';
/**
* Get the header title using the product name.
*
* @param editedProductName Name value entered for the product.
* @param editedProductName Name value entered for the product.
* @param initialProductName Name already persisted to the database.
* @return The new title
*/

View File

@ -6,6 +6,10 @@
],
"compilerOptions": {
"outDir": "build",
"resolveJsonModule": true
"resolveJsonModule": true,
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

View File

@ -6,7 +6,11 @@
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types",
"resolveJsonModule": true
"resolveJsonModule": true,
"typeRoots": [
"./typings",
"./node_modules/@types"
]
},
"include": [
"**/*.d.ts",

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Configuration change only

View File

@ -52,7 +52,7 @@
"concurrently": "^7.0.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3"
"typescript": "^4.9.5"
},
"lint-staged": {
"*.(t|j)s?(x)": [

View File

@ -1,6 +1,10 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
"outDir": "build",
"typeRoots": [
"./typings",
"./node_modules/@types"
]
}
}

Some files were not shown because too many files have changed in this diff Show More