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

Testing: Prevent a direct usage of Reakit #28095

Merged
merged 2 commits into from
Jan 12, 2021
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
33 changes: 23 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,29 @@ module.exports = {
},
],
'@wordpress/no-unsafe-wp-apis': 'off',
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'lodash',
importNames: [ 'memoize' ],
message: 'Please use `memize` instead.',
},
{
name: 'reakit',
message:
'Please use Reakit API through `@wordpress/components` instead.',
},
{
name: 'redux',
importNames: [ 'combineReducers' ],
message:
'Please use `combineReducers` from `@wordpress/data` instead.',
},
],
},
],
'no-restricted-syntax': [
'error',
// NOTE: We can't include the forward slash in our regex or
Expand All @@ -79,16 +102,6 @@ module.exports = {
message:
'Deprecated functions must be removed before releasing this version.',
},
{
selector:
'ImportDeclaration[source.value="redux"] Identifier.imported[name="combineReducers"]',
message: 'Use `combineReducers` from `@wordpress/data`',
},
{
selector:
'ImportDeclaration[source.value="lodash"] Identifier.imported[name="memoize"]',
message: 'Use memize instead of Lodash’s memoize',
},
{
selector:
'CallExpression[callee.object.name="page"][callee.property.name="waitFor"]',
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/composite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* The plan is to build own API that accounts for future breaking changes
* in Reakit (https://github.com/WordPress/gutenberg/pull/28085).
*/
/* eslint-disable-next-line no-restricted-imports */
export {
Composite,
CompositeGroup,
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/disclosure/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
* The plan is to build own API that accounts for future breaking changes
* in Reakit (https://github.com/WordPress/gutenberg/pull/28085).
*/
/* eslint-disable-next-line no-restricted-imports */
export { DisclosureContent } from 'reakit';