anied opened a new issue, #19856:
URL: https://github.com/apache/superset/issues/19856

   I am developing a superset plugin locally, with a local dev setup propped up 
following the [instructions in 
`CONTRIBUTING.md`](https://github.com/apache/superset/blob/master/CONTRIBUTING.md).
  In my `.tsx` file I am attempting to import several components from 
[`antd`](https://github.com/ant-design/ant-design) like so:
   
   ```typescript
   import { Menu, Dropdown } from 'antd';
   ```
   
   However, this generates the following lint warning:
   
   > `'antd' import is restricted from being used. Please import Ant components 
from the index of common/components`
   
   
   This appears to be defined in [superset frontend's `.eslintrc.js` 
file](https://github.com/apache/superset/blob/master/superset-frontend/.eslintrc.js#L243):
   
   ```javascript
   'no-restricted-imports': [
     'warn',
     {
       paths: [
         {
           name: 'antd',
           message:
             'Please import Ant components from the index of common/components',
         },
         {
           name: '@superset-ui/core',
           importNames: ['supersetTheme'],
           message:
             'Please use the theme directly from the ThemeProvider rather than 
importing supersetTheme.',
         },
       ],
     },
   ],
   ```
   
   However, no such `common/components` directory seems to exist anywhere in 
the superset codebase.  Trying several permutations to get this import at some 
version of this path all fail.  **What is the correct, expected way in which to 
import `antd` components into a plugin file?**
   
   #### How to reproduce the bug
   
   1. Follow the steps in 
[`CONTRIBUTING.md`](https://github.com/apache/superset/blob/master/CONTRIBUTING.md)
 to set up a local dev environment (for what it is worth, my setup is a little 
different in that I have my plugin in a separate directory and then `npm 
link`ed in
   2. Try to import Ant Design components using
       ```typescript
       import { Menu, Dropdown } from 'antd';
       ```
   
   ### Expected results
   
   The components are imported without any issues.
   
   ### Actual results
   
   A lint warning is given: `'antd' import is restricted from being used. 
Please import Ant components from the index of common/components`.  The files 
_do_, however, appear to be imported and available.  Attempting permutations 
such as 
   
   + ```typescript
       import { Menu, Dropdown } from 'common/components';
       ```
   + ```typescript
       import { Menu, Dropdown } from '@superset-ui/common/components';
       ```
   + ```typescript
       import { Menu, Dropdown, Space } from '@superset-ui/core/lib/components';
       ```
   
   ...all fail for various reasons.
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version: **Not Applicable**
   - superset version: **Superset 1.4.1**
   - python version: **Python 3.9.10**
   - node.js version: **8.3.1**
   - any feature flags active: **none** (that I am aware of)
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
       **Not applicable**
   - [ ] I have reproduced the issue with at least the latest released version 
of superset.
       **Not sure-- I find the various version tags a bit hard to parse**
   - [x] I have checked the issue tracker for the same issue and I haven't 
found one similar.
   
   ### Additional context
   
   n/a
   
   Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to