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

Allow ariakit and framer motion imports in the components package #63123

Merged
merged 4 commits into from
Jul 4, 2024
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
20 changes: 20 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,26 @@ module.exports = {
plugins: [ 'ssr-friendly' ],
extends: [ 'plugin:ssr-friendly/recommended' ],
},
{
files: [ 'packages/components/src/**' ],
rules: {
'no-restricted-imports': [
'error',
// The `ariakit` and `framer-motion` APIs are meant to be consumed via
// the `@wordpress/components` package, hence why importing those
// dependencies should be allowed in the components package.
{
paths: restrictedImports.filter(
( { name } ) =>
! [
'@ariakit/react',
'framer-motion',
].includes( name )
),
},
],
},
},
{
files: [ 'packages/block-editor/**' ],
rules: {
Expand Down
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

### Internal

- `Allow ariakit and framer motion imports in the components package. ([#63123](https://github.com/WordPress/gutenberg/pull/63123))
- `CustomSelectControlV2`: prevent keyboard event propagation in legacy wrapper. ([#62907](https://github.com/WordPress/gutenberg/pull/62907))
- `CustomSelectControlV2`: expose legacy wrapper through private APIs. ([#62936](https://github.com/WordPress/gutenberg/pull/62936))
- `CustomSelectControlV2`: fix item styles ([#62825](https://github.com/WordPress/gutenberg/pull/62825))
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/animation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* @see https://www.framer.com/docs/animation/
*/

// eslint-disable-next-line no-restricted-imports
export {
motion as __unstableMotion,
AnimatePresence as __unstableAnimatePresence,
Expand Down
2 changes: 0 additions & 2 deletions packages/components/src/composite/current/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* @see https://ariakit.org/components/composite
*/

/* eslint-disable-next-line no-restricted-imports */
export {
Composite,
CompositeGroup,
Expand All @@ -18,5 +17,4 @@ export {
useCompositeStore,
} from '@ariakit/react';

/* eslint-disable-next-line no-restricted-imports */
export type { CompositeStore, CompositeStoreProps } from '@ariakit/react';
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';
/**
* Internal dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';
import clsx from 'clsx';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';
import { css } from '@emotion/react';
import styled from '@emotion/styled';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import type * as Ariakit from '@ariakit/react';
import type { FocusEventHandler, MouseEventHandler } from 'react';

Expand Down
1 change: 0 additions & 1 deletion packages/components/src/disclosure/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';

/**
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/divider/component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';
import type { ForwardedRef } from 'react';

Expand Down
1 change: 0 additions & 1 deletion packages/components/src/divider/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import type { SeparatorProps } from '@ariakit/react';

/**
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/dropdown-menu-v2/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';

/**
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/dropdown-menu-v2/styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';
import { css, keyframes } from '@emotion/react';
import styled from '@emotion/styled';
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/dropdown-menu-v2/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import type * as Ariakit from '@ariakit/react';
import type { Placement } from '@floating-ui/react-dom';

Expand Down
2 changes: 0 additions & 2 deletions packages/components/src/popover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import {
offset as offsetMiddleware,
size,
} from '@floating-ui/react-dom';
// eslint-disable-next-line no-restricted-imports
import type { HTMLMotionProps, MotionProps } from 'framer-motion';
// eslint-disable-next-line no-restricted-imports
import { motion } from 'framer-motion';

/**
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/popover/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import type { MotionProps } from 'framer-motion';
import type { Placement, ReferenceType } from '@floating-ui/react-dom';

Expand Down
1 change: 0 additions & 1 deletion packages/components/src/radio-group/context.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import type * as Ariakit from '@ariakit/react';

/**
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/radio-group/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';

/**
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/radio-group/radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { forwardRef, useContext } from '@wordpress/element';
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';

/**
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/tab-panel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';
import clsx from 'clsx';
import type { ForwardedRef } from 'react';
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/tabs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';

/**
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/tabs/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import styled from '@emotion/styled';
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';

/**
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/tabs/tablist.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';

/**
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/tabs/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import type * as Ariakit from '@ariakit/react';

export type TabsContextProps =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
* External dependencies
*/
import type { ForwardedRef } from 'react';
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';
// eslint-disable-next-line no-restricted-imports
import { motion } from 'framer-motion';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import type { ForwardedRef } from 'react';
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import type { ForwardedRef } from 'react';
// eslint-disable-next-line no-restricted-imports
import { LayoutGroup } from 'framer-motion';

/**
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/toolbar/toolbar-context/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import type * as Ariakit from '@ariakit/react';

/**
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/toolbar/toolbar-item/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';
import type { ForwardedRef } from 'react';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';
import type { ForwardedRef } from 'react';

Expand Down
1 change: 0 additions & 1 deletion packages/components/src/tooltip/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';

/**
Expand Down
Loading