Configure eslint to prevent imports from nested paths of externally provided modules

Summary: We have a list of modules that we do not bundle with the plugins, but provide externally to them from Flipper. For the mechanism to work correctly, we have to stop importing from nested paths of these modules.

Reviewed By: mweststrate

Differential Revision: D39776237

fbshipit-source-id: 06eae9bf9d5b11b48d2720bf592bfea749773847
This commit is contained in:
Andrey Goncharov
2022-09-26 09:42:33 -07:00
committed by Facebook GitHub Bot
parent 982193df48
commit d1158e2d02
8 changed files with 40 additions and 12 deletions

View File

@@ -66,6 +66,26 @@ const restrictedImportsUniversalErrorConfig = {
message:
"Imports from nested flipper-ui-core directories are not allowed. Import from 'flipper-ui-core' module directly. If it is missing an export, add it there.",
},
{
group: ['antd/*'],
message:
"Imports from nested antd directories are not allowed. Import from 'antd' module directly. If you want to import only a type, use `import type` syntax and silence this warning.",
},
{
group: ['immer/*'],
message:
"Imports from nested antd directories are not allowed. Import from 'antd' module directly. If you want to import only a type, use `import type` syntax and silence this warning.",
},
{
group: ['@emotion/styled/*'],
message:
"Imports from nested @emotion/styled directories are not allowed. Import from '@emotion/styled' module directly. If you want to import only a type, use `import type` syntax and silence this warning.",
},
{
group: ['@ant-design/icons/*'],
message:
"Imports from nested @ant-design/icons directories are not allowed. Import from '@ant-design/icons' module directly. If you want to import only a type, use `import type` syntax and silence this warning.",
},
],
};