diff --git a/.eslintrc.js b/.eslintrc.js index d9f2b3ae8e132b..5e20681906c425 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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 @@ -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"]', diff --git a/packages/components/src/composite/index.js b/packages/components/src/composite/index.js index f1101a2c852e0e..ddb10fffa12ad9 100644 --- a/packages/components/src/composite/index.js +++ b/packages/components/src/composite/index.js @@ -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, diff --git a/packages/components/src/disclosure/index.js b/packages/components/src/disclosure/index.js index 2789ab6d307ef7..5458ba053eef6a 100644 --- a/packages/components/src/disclosure/index.js +++ b/packages/components/src/disclosure/index.js @@ -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';