@atlaskit/tabs 16.1.2 → 16.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/__perf__/default.tsx +16 -16
  3. package/codemods/13.0.0-lite-mode.tsx +14 -18
  4. package/codemods/__tests__/13.0.0-lite-mode.tsx +44 -44
  5. package/codemods/__tests__/add-id-prop.tsx +13 -13
  6. package/codemods/__tests__/map-tabs-prop.tsx +42 -42
  7. package/codemods/__tests__/on-select-to-on-change.tsx +49 -49
  8. package/codemods/__tests__/remove-components-prop.tsx +14 -14
  9. package/codemods/__tests__/remove-is-selected-test-prop.tsx +14 -14
  10. package/codemods/__tests__/remove-tab-item-tab-content.tsx +7 -7
  11. package/codemods/__tests__/remove-types.tsx +14 -14
  12. package/codemods/__tests__/rename-is-content-persisted-to-should-unmount-tab-panel-on-change.tsx +36 -38
  13. package/codemods/migrations/add-id-prop.tsx +37 -45
  14. package/codemods/migrations/map-tabs-prop.tsx +143 -164
  15. package/codemods/migrations/on-select-to-on-change.tsx +66 -76
  16. package/codemods/migrations/remove-components-prop.tsx +3 -3
  17. package/codemods/migrations/remove-is-selected-test-prop.tsx +3 -3
  18. package/codemods/migrations/remove-tab-item-tab-content.tsx +19 -22
  19. package/codemods/migrations/remove-types.tsx +32 -32
  20. package/codemods/migrations/rename-is-content-persisted-to-should-unmount-tab-panel-on-change.tsx +46 -59
  21. package/codemods/utils.tsx +25 -28
  22. package/dist/cjs/components/tab-list.js +5 -0
  23. package/dist/cjs/components/tab-panel.js +5 -0
  24. package/dist/cjs/components/tab.js +4 -0
  25. package/dist/cjs/components/tabs.js +4 -2
  26. package/dist/cjs/internal/styles.js +8 -5
  27. package/dist/es2019/components/tab-list.js +5 -0
  28. package/dist/es2019/components/tab-panel.js +5 -0
  29. package/dist/es2019/components/tab.js +4 -0
  30. package/dist/es2019/components/tabs.js +6 -1
  31. package/dist/es2019/internal/styles.js +9 -4
  32. package/dist/esm/components/tab-list.js +5 -0
  33. package/dist/esm/components/tab-panel.js +5 -0
  34. package/dist/esm/components/tab.js +4 -0
  35. package/dist/esm/components/tabs.js +6 -1
  36. package/dist/esm/internal/styles.js +8 -4
  37. package/dist/types/components/tab.d.ts +3 -0
  38. package/dist/types-ts4.5/components/tab.d.ts +3 -0
  39. package/extract-react-types/tab-attributes.tsx +1 -1
  40. package/extract-react-types/tab-panel-attributes.tsx +1 -1
  41. package/package.json +93 -93
  42. package/report.api.md +40 -42
@@ -1,21 +1,18 @@
1
1
  import {
2
- type ASTPath,
3
- type default as core,
4
- type ImportDeclaration,
5
- type JSXElement,
2
+ type ASTPath,
3
+ type default as core,
4
+ type ImportDeclaration,
5
+ type JSXElement,
6
6
  } from 'jscodeshift';
7
7
  import { type Collection } from 'jscodeshift/src/Collection';
8
8
 
9
9
  import {
10
- addCommentToStartOfFile,
11
- getDefaultSpecifier,
12
- getJSXAttributesByName,
10
+ addCommentToStartOfFile,
11
+ getDefaultSpecifier,
12
+ getJSXAttributesByName,
13
13
  } from '@atlaskit/codemod-utils';
14
14
 
15
- import {
16
- createRemoveFuncWithDefaultSpecifierFor,
17
- doesIdentifierExist,
18
- } from '../utils';
15
+ import { createRemoveFuncWithDefaultSpecifierFor, doesIdentifierExist } from '../utils';
19
16
 
20
17
  const spreadComment = `
21
18
  This file is spreading props on the Tabs component.
@@ -31,162 +28,144 @@ https://atlassian.design/components/tabs/examples
31
28
  `;
32
29
 
33
30
  const getImportSpecifiers = (j: core.JSCodeshift, defined: Array<string>) => {
34
- return ['Tab', 'TabList', 'TabPanel'].map((specifier) => {
35
- if (!defined.includes(specifier)) {
36
- return j.importSpecifier(
37
- j.identifier(specifier),
38
- j.identifier(`Atlaskit${specifier}`),
39
- );
40
- } else {
41
- return j.importSpecifier(j.identifier(specifier));
42
- }
43
- });
31
+ return ['Tab', 'TabList', 'TabPanel'].map((specifier) => {
32
+ if (!defined.includes(specifier)) {
33
+ return j.importSpecifier(j.identifier(specifier), j.identifier(`Atlaskit${specifier}`));
34
+ } else {
35
+ return j.importSpecifier(j.identifier(specifier));
36
+ }
37
+ });
44
38
  };
45
39
 
46
40
  const packageName = '@atlaskit/tabs';
47
41
  export const mapTabsProp = (j: core.JSCodeshift, source: Collection<Node>) => {
48
- const specifier = getDefaultSpecifier(j, source, packageName);
49
-
50
- if (!specifier) {
51
- return;
52
- }
53
-
54
- const tabTagName = doesIdentifierExist({ j, base: source, name: 'Tab' })
55
- ? 'AtlaskitTab'
56
- : 'Tab';
57
- const tabListTagName = doesIdentifierExist({
58
- j,
59
- base: source,
60
- name: 'TabList',
61
- })
62
- ? 'AtlaskitTabList'
63
- : 'TabList';
64
- const tabPanelTagName = doesIdentifierExist({
65
- j,
66
- base: source,
67
- name: 'TabPanel',
68
- })
69
- ? 'AtlaskitTabPanel'
70
- : 'TabPanel';
71
-
72
- source.findJSXElements(specifier).forEach((element: ASTPath<JSXElement>) => {
73
- let tabs;
74
-
75
- getJSXAttributesByName(j, element, 'tabs').forEach((attribute: any) => {
76
- tabs = attribute.value.value.expression;
77
- });
78
- if (!tabs) {
79
- j(element)
80
- .find(j.JSXOpeningElement)
81
- .find(j.JSXSpreadAttribute)
82
- .forEach((spreadAttribute) => {
83
- // If using spread then leave a comment indicating further research being needed
84
- addCommentToStartOfFile({ j, base: source, message: spreadComment });
85
- const spreadArgument = spreadAttribute.value.argument;
86
- tabs = j.memberExpression(spreadArgument, j.identifier('tabs'));
87
- });
88
- }
89
-
90
- if (!tabs) {
91
- return;
92
- }
93
-
94
- const newLine = j.jsxText('\n');
95
-
96
- const tabList = j.jsxElement(
97
- j.jsxOpeningElement(j.jsxIdentifier(tabListTagName)),
98
- j.jsxClosingElement(j.jsxIdentifier(tabListTagName)),
99
- [
100
- j.jsxText('\n'),
101
- j.jsxExpressionContainer(
102
- j.callExpression(j.memberExpression(tabs, j.identifier('map')), [
103
- j.arrowFunctionExpression(
104
- [j.identifier('tab'), j.identifier('index')],
105
- j.jsxElement(
106
- j.jsxOpeningElement(j.jsxIdentifier(tabTagName), [
107
- j.jsxAttribute(
108
- j.jsxIdentifier('testId'),
109
- j.jsxExpressionContainer(j.identifier('tab.testId')),
110
- ),
111
- j.jsxAttribute(
112
- j.jsxIdentifier('key'),
113
- j.jsxExpressionContainer(j.identifier('index')),
114
- ),
115
- ]),
116
- j.jsxClosingElement(j.jsxIdentifier(tabTagName)),
117
- [j.jsxExpressionContainer(j.identifier('tab.label'))],
118
- ),
119
- ),
120
- ]),
121
- ),
122
- j.jsxText('\n'),
123
- ],
124
- );
125
-
126
- const tabPanels = j.jsxExpressionContainer(
127
- j.callExpression(j.memberExpression(tabs, j.identifier('map')), [
128
- j.arrowFunctionExpression(
129
- [j.identifier('tab'), j.identifier('index')],
130
- j.jsxElement(
131
- j.jsxOpeningElement(j.jsxIdentifier(tabPanelTagName), [
132
- j.jsxAttribute(
133
- j.jsxIdentifier('key'),
134
- j.jsxExpressionContainer(j.identifier('index')),
135
- ),
136
- ]),
137
- j.jsxClosingElement(j.jsxIdentifier(tabPanelTagName)),
138
- [j.jsxExpressionContainer(j.identifier('tab.content'))],
139
- ),
140
- ),
141
- ]),
142
- );
143
-
144
- const tabsChildren = [newLine, tabList, newLine, tabPanels, newLine];
145
-
146
- j(element)
147
- .find(j.JSXOpeningElement)
148
- .forEach((openingElement) => {
149
- // @ts-ignore
150
- if (openingElement.value.name.name === specifier) {
151
- j(openingElement).replaceWith(
152
- j.jsxElement(
153
- j.jsxOpeningElement(
154
- j.jsxIdentifier(specifier),
155
- openingElement.value.attributes,
156
- ),
157
- j.jsxClosingElement(j.jsxIdentifier(specifier)),
158
- tabsChildren,
159
- ),
160
- );
161
- }
162
- });
163
- });
164
-
165
- const specifiers = getImportSpecifiers(j, [
166
- tabTagName,
167
- tabListTagName,
168
- tabPanelTagName,
169
- ]);
170
-
171
- source
172
- .find(j.ImportDeclaration)
173
- .filter(
174
- (path: ASTPath<ImportDeclaration>) =>
175
- path.node.source.value === packageName,
176
- )
177
- .forEach((path: ASTPath<ImportDeclaration>) => {
178
- j(path).replaceWith(
179
- j.importDeclaration(
180
- // @ts-ignore
181
- [...path.value.specifiers, ...specifiers],
182
-
183
- j.literal(packageName),
184
- ),
185
- );
186
- });
42
+ const specifier = getDefaultSpecifier(j, source, packageName);
43
+
44
+ if (!specifier) {
45
+ return;
46
+ }
47
+
48
+ const tabTagName = doesIdentifierExist({ j, base: source, name: 'Tab' }) ? 'AtlaskitTab' : 'Tab';
49
+ const tabListTagName = doesIdentifierExist({
50
+ j,
51
+ base: source,
52
+ name: 'TabList',
53
+ })
54
+ ? 'AtlaskitTabList'
55
+ : 'TabList';
56
+ const tabPanelTagName = doesIdentifierExist({
57
+ j,
58
+ base: source,
59
+ name: 'TabPanel',
60
+ })
61
+ ? 'AtlaskitTabPanel'
62
+ : 'TabPanel';
63
+
64
+ source.findJSXElements(specifier).forEach((element: ASTPath<JSXElement>) => {
65
+ let tabs;
66
+
67
+ getJSXAttributesByName(j, element, 'tabs').forEach((attribute: any) => {
68
+ tabs = attribute.value.value.expression;
69
+ });
70
+ if (!tabs) {
71
+ j(element)
72
+ .find(j.JSXOpeningElement)
73
+ .find(j.JSXSpreadAttribute)
74
+ .forEach((spreadAttribute) => {
75
+ // If using spread then leave a comment indicating further research being needed
76
+ addCommentToStartOfFile({ j, base: source, message: spreadComment });
77
+ const spreadArgument = spreadAttribute.value.argument;
78
+ tabs = j.memberExpression(spreadArgument, j.identifier('tabs'));
79
+ });
80
+ }
81
+
82
+ if (!tabs) {
83
+ return;
84
+ }
85
+
86
+ const newLine = j.jsxText('\n');
87
+
88
+ const tabList = j.jsxElement(
89
+ j.jsxOpeningElement(j.jsxIdentifier(tabListTagName)),
90
+ j.jsxClosingElement(j.jsxIdentifier(tabListTagName)),
91
+ [
92
+ j.jsxText('\n'),
93
+ j.jsxExpressionContainer(
94
+ j.callExpression(j.memberExpression(tabs, j.identifier('map')), [
95
+ j.arrowFunctionExpression(
96
+ [j.identifier('tab'), j.identifier('index')],
97
+ j.jsxElement(
98
+ j.jsxOpeningElement(j.jsxIdentifier(tabTagName), [
99
+ j.jsxAttribute(
100
+ j.jsxIdentifier('testId'),
101
+ j.jsxExpressionContainer(j.identifier('tab.testId')),
102
+ ),
103
+ j.jsxAttribute(
104
+ j.jsxIdentifier('key'),
105
+ j.jsxExpressionContainer(j.identifier('index')),
106
+ ),
107
+ ]),
108
+ j.jsxClosingElement(j.jsxIdentifier(tabTagName)),
109
+ [j.jsxExpressionContainer(j.identifier('tab.label'))],
110
+ ),
111
+ ),
112
+ ]),
113
+ ),
114
+ j.jsxText('\n'),
115
+ ],
116
+ );
117
+
118
+ const tabPanels = j.jsxExpressionContainer(
119
+ j.callExpression(j.memberExpression(tabs, j.identifier('map')), [
120
+ j.arrowFunctionExpression(
121
+ [j.identifier('tab'), j.identifier('index')],
122
+ j.jsxElement(
123
+ j.jsxOpeningElement(j.jsxIdentifier(tabPanelTagName), [
124
+ j.jsxAttribute(
125
+ j.jsxIdentifier('key'),
126
+ j.jsxExpressionContainer(j.identifier('index')),
127
+ ),
128
+ ]),
129
+ j.jsxClosingElement(j.jsxIdentifier(tabPanelTagName)),
130
+ [j.jsxExpressionContainer(j.identifier('tab.content'))],
131
+ ),
132
+ ),
133
+ ]),
134
+ );
135
+
136
+ const tabsChildren = [newLine, tabList, newLine, tabPanels, newLine];
137
+
138
+ j(element)
139
+ .find(j.JSXOpeningElement)
140
+ .forEach((openingElement) => {
141
+ // @ts-ignore
142
+ if (openingElement.value.name.name === specifier) {
143
+ j(openingElement).replaceWith(
144
+ j.jsxElement(
145
+ j.jsxOpeningElement(j.jsxIdentifier(specifier), openingElement.value.attributes),
146
+ j.jsxClosingElement(j.jsxIdentifier(specifier)),
147
+ tabsChildren,
148
+ ),
149
+ );
150
+ }
151
+ });
152
+ });
153
+
154
+ const specifiers = getImportSpecifiers(j, [tabTagName, tabListTagName, tabPanelTagName]);
155
+
156
+ source
157
+ .find(j.ImportDeclaration)
158
+ .filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === packageName)
159
+ .forEach((path: ASTPath<ImportDeclaration>) => {
160
+ j(path).replaceWith(
161
+ j.importDeclaration(
162
+ // @ts-ignore
163
+ [...path.value.specifiers, ...specifiers],
164
+
165
+ j.literal(packageName),
166
+ ),
167
+ );
168
+ });
187
169
  };
188
170
 
189
- export const removeTabsProp = createRemoveFuncWithDefaultSpecifierFor(
190
- '@atlaskit/tabs',
191
- 'tabs',
192
- );
171
+ export const removeTabsProp = createRemoveFuncWithDefaultSpecifierFor('@atlaskit/tabs', 'tabs');
@@ -1,14 +1,10 @@
1
- import {
2
- type ASTPath,
3
- type default as core,
4
- type JSXElement,
5
- } from 'jscodeshift';
1
+ import { type ASTPath, type default as core, type JSXElement } from 'jscodeshift';
6
2
  import { type Collection } from 'jscodeshift/src/Collection';
7
3
 
8
4
  import {
9
- addCommentToStartOfFile,
10
- getDefaultSpecifier,
11
- getJSXAttributesByName,
5
+ addCommentToStartOfFile,
6
+ getDefaultSpecifier,
7
+ getJSXAttributesByName,
12
8
  } from '@atlaskit/codemod-utils';
13
9
 
14
10
  const comment = `
@@ -30,72 +26,66 @@ If you are using the selected prop you will need to ensure that you are passing
30
26
  of the selected tab as it also doesn't accept TabData anymore.
31
27
  `;
32
28
 
33
- export const migrateOnSelectType = (
34
- j: core.JSCodeshift,
35
- source: Collection<Node>,
36
- ) => {
37
- const specifier = getDefaultSpecifier(j, source, '@atlaskit/tabs');
38
-
39
- if (!specifier) {
40
- return;
41
- }
42
-
43
- source.findJSXElements(specifier).forEach((element: ASTPath<JSXElement>) => {
44
- let tabs: any;
45
- getJSXAttributesByName(j, element, 'tabs').forEach((attribute: any) => {
46
- tabs = attribute.value.value.expression;
47
- });
48
-
49
- if (!tabs) {
50
- j(element)
51
- .find(j.JSXOpeningElement)
52
- .find(j.JSXSpreadAttribute)
53
- .forEach((spreadAttribute) => {
54
- const spreadArgument = spreadAttribute.value.argument;
55
- tabs = j.memberExpression(spreadArgument, j.identifier('tabs'));
56
- });
57
- }
58
-
59
- if (!tabs) {
60
- return;
61
- }
62
-
63
- getJSXAttributesByName(j, element, 'onSelect').forEach((attribute: any) => {
64
- addCommentToStartOfFile({ j, base: source, message: comment });
65
- const onChangeValue = attribute.node.value.expression;
66
-
67
- let selectedTab = j.variableDeclaration('const', [
68
- j.variableDeclarator(
69
- j.identifier('selectedTab'),
70
- j.memberExpression(tabs, j.identifier('index'), true),
71
- ),
72
- ]);
73
-
74
- // Wrap arrow functions to create an IIFE
75
- let onChangeCall = onChangeValue.name
76
- ? onChangeValue
77
- : j.parenthesizedExpression(onChangeValue);
78
-
79
- const newVersionOfFn = j.arrowFunctionExpression(
80
- [j.identifier('index'), j.identifier('analyticsEvent')],
81
- j.blockStatement([
82
- selectedTab,
83
- j.expressionStatement(
84
- j.callExpression(onChangeCall, [
85
- j.identifier('selectedTab'),
86
- j.identifier('index'),
87
- j.identifier('analyticsEvent'),
88
- ]),
89
- ),
90
- ]),
91
- );
92
-
93
- j(attribute).replaceWith(
94
- j.jsxAttribute(
95
- j.jsxIdentifier('onChange'),
96
- j.jsxExpressionContainer(newVersionOfFn),
97
- ),
98
- );
99
- });
100
- });
29
+ export const migrateOnSelectType = (j: core.JSCodeshift, source: Collection<Node>) => {
30
+ const specifier = getDefaultSpecifier(j, source, '@atlaskit/tabs');
31
+
32
+ if (!specifier) {
33
+ return;
34
+ }
35
+
36
+ source.findJSXElements(specifier).forEach((element: ASTPath<JSXElement>) => {
37
+ let tabs: any;
38
+ getJSXAttributesByName(j, element, 'tabs').forEach((attribute: any) => {
39
+ tabs = attribute.value.value.expression;
40
+ });
41
+
42
+ if (!tabs) {
43
+ j(element)
44
+ .find(j.JSXOpeningElement)
45
+ .find(j.JSXSpreadAttribute)
46
+ .forEach((spreadAttribute) => {
47
+ const spreadArgument = spreadAttribute.value.argument;
48
+ tabs = j.memberExpression(spreadArgument, j.identifier('tabs'));
49
+ });
50
+ }
51
+
52
+ if (!tabs) {
53
+ return;
54
+ }
55
+
56
+ getJSXAttributesByName(j, element, 'onSelect').forEach((attribute: any) => {
57
+ addCommentToStartOfFile({ j, base: source, message: comment });
58
+ const onChangeValue = attribute.node.value.expression;
59
+
60
+ let selectedTab = j.variableDeclaration('const', [
61
+ j.variableDeclarator(
62
+ j.identifier('selectedTab'),
63
+ j.memberExpression(tabs, j.identifier('index'), true),
64
+ ),
65
+ ]);
66
+
67
+ // Wrap arrow functions to create an IIFE
68
+ let onChangeCall = onChangeValue.name
69
+ ? onChangeValue
70
+ : j.parenthesizedExpression(onChangeValue);
71
+
72
+ const newVersionOfFn = j.arrowFunctionExpression(
73
+ [j.identifier('index'), j.identifier('analyticsEvent')],
74
+ j.blockStatement([
75
+ selectedTab,
76
+ j.expressionStatement(
77
+ j.callExpression(onChangeCall, [
78
+ j.identifier('selectedTab'),
79
+ j.identifier('index'),
80
+ j.identifier('analyticsEvent'),
81
+ ]),
82
+ ),
83
+ ]),
84
+ );
85
+
86
+ j(attribute).replaceWith(
87
+ j.jsxAttribute(j.jsxIdentifier('onChange'), j.jsxExpressionContainer(newVersionOfFn)),
88
+ );
89
+ });
90
+ });
101
91
  };
@@ -14,7 +14,7 @@ https://atlassian.design/components/tabs/examples#customizing-tab-panel
14
14
  `;
15
15
 
16
16
  export const removeComponentsProp = createRemoveFuncWithDefaultSpecifierFor(
17
- '@atlaskit/tabs',
18
- 'components',
19
- comment,
17
+ '@atlaskit/tabs',
18
+ 'components',
19
+ comment,
20
20
  );
@@ -11,7 +11,7 @@ This is documented at https:atlassian.design/components/tabs/examples#controlled
11
11
  `;
12
12
 
13
13
  export const removeIsSelectedTestProp = createRemoveFuncWithDefaultSpecifierFor(
14
- '@atlaskit/tabs',
15
- 'isSelectedTest',
16
- comment,
14
+ '@atlaskit/tabs',
15
+ 'isSelectedTest',
16
+ comment,
17
17
  );
@@ -1,29 +1,26 @@
1
1
  import {
2
- type ASTPath,
3
- type default as core,
4
- type ImportDeclaration,
5
- type ImportSpecifier,
2
+ type ASTPath,
3
+ type default as core,
4
+ type ImportDeclaration,
5
+ type ImportSpecifier,
6
6
  } from 'jscodeshift';
7
7
  import { type Collection } from 'jscodeshift/src/Collection';
8
8
 
9
9
  const component = '@atlaskit/tabs';
10
10
 
11
- export const removeTabItemTabContent = (
12
- j: core.JSCodeshift,
13
- source: Collection<Node>,
14
- ) => {
15
- source
16
- .find(j.ImportDeclaration)
17
- .filter(
18
- (importDeclaration: ASTPath<ImportDeclaration>) =>
19
- importDeclaration.node.source.value === component,
20
- )
21
- // Tabs only exported TabItem and TabContent from base so remove them
22
- .forEach((importDeclaration) => {
23
- j(importDeclaration)
24
- .find(j.ImportSpecifier)
25
- .forEach((importSpecifier: ASTPath<ImportSpecifier>) => {
26
- j(importSpecifier).remove();
27
- });
28
- });
11
+ export const removeTabItemTabContent = (j: core.JSCodeshift, source: Collection<Node>) => {
12
+ source
13
+ .find(j.ImportDeclaration)
14
+ .filter(
15
+ (importDeclaration: ASTPath<ImportDeclaration>) =>
16
+ importDeclaration.node.source.value === component,
17
+ )
18
+ // Tabs only exported TabItem and TabContent from base so remove them
19
+ .forEach((importDeclaration) => {
20
+ j(importDeclaration)
21
+ .find(j.ImportSpecifier)
22
+ .forEach((importSpecifier: ASTPath<ImportSpecifier>) => {
23
+ j(importSpecifier).remove();
24
+ });
25
+ });
29
26
  };
@@ -1,45 +1,45 @@
1
1
  import {
2
- type ASTPath,
3
- type default as core,
4
- type ImportDeclaration,
5
- type ImportSpecifier,
2
+ type ASTPath,
3
+ type default as core,
4
+ type ImportDeclaration,
5
+ type ImportSpecifier,
6
6
  } from 'jscodeshift';
7
7
  import { type Collection } from 'jscodeshift/src/Collection';
8
8
 
9
9
  const component = '@atlaskit/tabs/types';
10
10
  const existingTypes = [
11
- 'TabProps',
12
- 'TabPanelProps',
13
- 'TabsProps',
14
- 'TabListProps',
15
- 'TabAttributesType',
16
- 'TabListAttributesType',
17
- 'TabPanelAttributesType',
18
- 'TabData',
11
+ 'TabProps',
12
+ 'TabPanelProps',
13
+ 'TabsProps',
14
+ 'TabListProps',
15
+ 'TabAttributesType',
16
+ 'TabListAttributesType',
17
+ 'TabPanelAttributesType',
18
+ 'TabData',
19
19
  ];
20
20
 
21
21
  export const removeTypes = (j: core.JSCodeshift, source: Collection<Node>) => {
22
- source
23
- .find(j.ImportDeclaration)
24
- .filter(
25
- (importDeclaration: ASTPath<ImportDeclaration>) =>
26
- importDeclaration.node.source.value === component,
27
- )
28
- .forEach((importDeclaration) => {
29
- const specifiers = j(importDeclaration)
30
- .find(j.ImportSpecifier)
31
- .filter((importSpecifier: ASTPath<ImportSpecifier>) => {
32
- if (!existingTypes.includes(importSpecifier.node.imported.name)) {
33
- j(importSpecifier).remove();
22
+ source
23
+ .find(j.ImportDeclaration)
24
+ .filter(
25
+ (importDeclaration: ASTPath<ImportDeclaration>) =>
26
+ importDeclaration.node.source.value === component,
27
+ )
28
+ .forEach((importDeclaration) => {
29
+ const specifiers = j(importDeclaration)
30
+ .find(j.ImportSpecifier)
31
+ .filter((importSpecifier: ASTPath<ImportSpecifier>) => {
32
+ if (!existingTypes.includes(importSpecifier.node.imported.name)) {
33
+ j(importSpecifier).remove();
34
34
 
35
- return false;
36
- }
35
+ return false;
36
+ }
37
37
 
38
- return true;
39
- });
38
+ return true;
39
+ });
40
40
 
41
- if (!specifiers.length) {
42
- j(importDeclaration).remove();
43
- }
44
- });
41
+ if (!specifiers.length) {
42
+ j(importDeclaration).remove();
43
+ }
44
+ });
45
45
  };