@transferwise/components 0.0.0-experimental-1c5d31a → 0.0.0-experimental-d024c8c

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 (45) hide show
  1. package/build/es/no-polyfill/common/flowHeader/FlowHeader.js +1 -1
  2. package/build/es/no-polyfill/common/flowHeader/index.js +1 -0
  3. package/build/es/no-polyfill/common/hooks/index.js +1 -1
  4. package/build/es/no-polyfill/common/hooks/useClientWidth/index.js +1 -0
  5. package/build/es/no-polyfill/common/hooks/useClientWidth/useClientWidth.js +3 -5
  6. package/build/es/no-polyfill/common/hooks/useLayout/useLayout.js +1 -1
  7. package/build/es/no-polyfill/flowNavigation/FlowNavigation.js +2 -2
  8. package/build/es/no-polyfill/flowNavigation/index.js +1 -0
  9. package/build/es/no-polyfill/index.js +1 -1
  10. package/build/es/no-polyfill/overlayHeader/OverlayHeader.js +1 -1
  11. package/build/es/no-polyfill/stepper/Stepper.js +1 -1
  12. package/build/es/no-polyfill/stepper/index.js +1 -0
  13. package/build/es/polyfill/common/flowHeader/FlowHeader.js +1 -1
  14. package/build/es/polyfill/common/flowHeader/index.js +1 -0
  15. package/build/es/polyfill/common/hooks/index.js +1 -1
  16. package/build/es/polyfill/common/hooks/useClientWidth/index.js +1 -0
  17. package/build/es/polyfill/common/hooks/useClientWidth/useClientWidth.js +3 -5
  18. package/build/es/polyfill/common/hooks/useLayout/useLayout.js +1 -1
  19. package/build/es/polyfill/flowNavigation/FlowNavigation.js +2 -2
  20. package/build/es/polyfill/flowNavigation/index.js +1 -0
  21. package/build/es/polyfill/index.js +1 -1
  22. package/build/es/polyfill/overlayHeader/OverlayHeader.js +1 -1
  23. package/build/es/polyfill/stepper/Stepper.js +1 -1
  24. package/build/es/polyfill/stepper/index.js +1 -0
  25. package/build/main.css +1 -1
  26. package/build/styles/main.css +1 -1
  27. package/build/styles/stepper/Stepper.css +1 -1
  28. package/build/types/common/flowHeader/FlowHeader.d.ts +1 -10
  29. package/build/types/common/flowHeader/index.d.ts +1 -0
  30. package/build/types/common/hooks/index.d.ts +1 -1
  31. package/build/types/common/hooks/useClientWidth/index.d.ts +1 -0
  32. package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts +9 -10
  33. package/build/types/flowNavigation/FlowNavigation.d.ts +34 -16
  34. package/build/types/flowNavigation/index.d.ts +1 -0
  35. package/build/types/index.d.ts +2 -2
  36. package/build/types/stepper/Stepper.d.ts +18 -13
  37. package/build/types/stepper/index.d.ts +2 -0
  38. package/build/umd/no-polyfill/main.js +1 -1
  39. package/build/umd/polyfill/main.js +1 -1
  40. package/package.json +4 -13
  41. package/scripts/generate-type-declarations.js +2 -0
  42. package/scripts/neptune-upgrader.js +0 -114
  43. package/upgrades/2021-02-v34-35.js +0 -193
  44. package/upgrades/2021-04-v35-36-typescript-support.js +0 -290
  45. package/upgrades/utils/index.js +0 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-1c5d31a",
3
+ "version": "0.0.0-experimental-d024c8c",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/umd/polyfill/main.js",
@@ -12,17 +12,13 @@
12
12
  ],
13
13
  "files": [
14
14
  "build",
15
- "scripts",
16
- "upgrades"
15
+ "scripts"
17
16
  ],
18
17
  "repository": {
19
18
  "type": "git",
20
19
  "fullname": "transferwise/neptune",
21
20
  "url": "git+https://github.com/transferwise/neptune-web.git"
22
21
  },
23
- "bin": {
24
- "neptune-upgrade-util": "scripts/neptune-upgrader.js"
25
- },
26
22
  "devDependencies": {
27
23
  "@formatjs/cli": "^4.8.3",
28
24
  "@rollup/plugin-babel": "^5.2.2",
@@ -53,7 +49,6 @@
53
49
  "@transferwise/icons": "^3.2.3",
54
50
  "@transferwise/neptune-tokens": "^8.5.0",
55
51
  "@types/jest": "^26.0.20",
56
- "@types/jscodeshift": "^0.11.0",
57
52
  "@types/node": "^14.14.31",
58
53
  "@types/react-transition-group": "4.4.5",
59
54
  "@types/testing-library__jest-dom": "^5.14.5",
@@ -72,12 +67,12 @@
72
67
  "rollup-plugin-uglify": "^6.0.4",
73
68
  "storybook": "^7.0.6",
74
69
  "@transferwise/less-config": "3.0.6",
75
- "@transferwise/neptune-css": "14.3.49",
70
+ "@transferwise/neptune-css": "0.0.0-experimental-d024c8c",
76
71
  "@wise/components-theming": "0.7.5"
77
72
  },
78
73
  "peerDependencies": {
79
74
  "@transferwise/icons": "^3.2.3",
80
- "@transferwise/neptune-css": "^14.3.49",
75
+ "@transferwise/neptune-css": "0.0.0-experimental-d024c8c",
81
76
  "@wise/art": "^2",
82
77
  "@wise/components-theming": "0.5 - 0.7",
83
78
  "currency-flags": "^4.0.2",
@@ -101,13 +96,9 @@
101
96
  "@react-spring/web": "~9.6.1",
102
97
  "@transferwise/formatting": "^2.1.0",
103
98
  "@transferwise/neptune-validation": "^3.0.12",
104
- "@types/lodash.throttle": "^4.1.7",
105
99
  "classnames": "^2.2.6",
106
100
  "commonmark": "0.29.1",
107
101
  "core-js": "^3.8.0",
108
- "inquirer": "^8.1.1",
109
- "inquirer-file-tree-selection-prompt": "^1.0.7",
110
- "jscodeshift": "^0.11.0",
111
102
  "lodash.clamp": "^4.0.3",
112
103
  "lodash.debounce": "^4.0.8",
113
104
  "lodash.difference": "^4.5.0",
@@ -18,6 +18,8 @@ const jsFiles = [
18
18
  { filename: 'Radio', folder: 'radio' },
19
19
  { filename: 'Select', folder: 'select' },
20
20
  { filename: 'MoneyInput', folder: 'moneyInput' },
21
+ { filename: 'Stepper', folder: 'stepper' },
22
+ { filename: 'FlowNavigation', folder: 'flowNavigation' },
21
23
  { filename: 'Popover', folder: 'popover' },
22
24
  { filename: 'Money', folder: 'money' },
23
25
  { filename: 'RadioOption', folder: 'radioOption' },
@@ -1,114 +0,0 @@
1
- #!/usr/bin/env node
2
- /* eslint-disable no-console */
3
-
4
- const { exec } = require('child_process');
5
- const path = require('path');
6
-
7
- const inquirer = require('inquirer');
8
- const inquirerFileTreeSelection = require('inquirer-file-tree-selection-prompt');
9
-
10
- inquirer.registerPrompt('file-tree-selection', inquirerFileTreeSelection);
11
-
12
- const IGNORE_PATTERN = '**/node_modules/*';
13
- const EXTENSIONS = {
14
- JS: 'js & jsx',
15
- TSX: 'tsx',
16
- BOTH: 'js,jsx & tsx',
17
- };
18
-
19
- const fetchSettings = () => {
20
- const questions = [
21
- {
22
- name: 'transform',
23
- type: 'file-tree-selection',
24
- root: path.join(__dirname, '../upgrades'),
25
- message: '✨ Which upgrade would you like to run?',
26
- },
27
- {
28
- type: 'list',
29
- name: 'extension',
30
- message: '✨ What file extensions should I look at?',
31
- choices: Object.values(EXTENSIONS),
32
- },
33
- {
34
- name: 'files',
35
- type: 'file-tree-selection',
36
- onlyShowDir: true,
37
- root: process.cwd(),
38
- message: '✨ And what directory would you like to transform?',
39
- },
40
- ];
41
- return inquirer.prompt(questions);
42
- };
43
-
44
- const fetchOptions = () => {
45
- const questions = [
46
- {
47
- name: 'dry',
48
- type: 'confirm',
49
- message: '✨ Dry run? (no changes are made to files)',
50
- },
51
- {
52
- name: 'verbose',
53
- type: 'confirm',
54
- message: '✨ Extra logging?',
55
- default: false,
56
- },
57
- ];
58
- return inquirer.prompt(questions);
59
- };
60
-
61
- const okToProceed = () => {
62
- const questions = [
63
- {
64
- name: 'confirm',
65
- type: 'confirm',
66
- message: 'Does everything look ok?',
67
- },
68
- ];
69
- return inquirer.prompt(questions);
70
- };
71
-
72
- const run = async () => {
73
- const { transform, extension, files } = await fetchSettings();
74
- const { dry, verbose } = await fetchOptions();
75
-
76
- console.log(`✨ Please review the following:`);
77
- console.log(`✨ Upgrade script: ${transform}`);
78
- console.log(`✨ File extension(s): ${extension}`);
79
- console.log(`✨ Directory: ${files}`);
80
- console.log(`✨ Dry run: ${dry}`);
81
-
82
- const { confirm } = await okToProceed();
83
-
84
- const options = `${dry ? '-d' : ''} ${verbose ? '-v=2' : ''}`;
85
-
86
- const handleOutput = (error, stdout, stderr) => {
87
- if (error) {
88
- console.log(stderr);
89
- return;
90
- }
91
- console.log(stdout);
92
- };
93
-
94
- const codeshiftPath = path.join(__dirname, '../node_modules/.bin/jscodeshift');
95
-
96
- const coreCommand = `${codeshiftPath} ${files} -t=${transform} ${options}`;
97
-
98
- if (confirm) {
99
- console.log('🚀 Running codemod, please wait a few seconds...');
100
- if (extension === EXTENSIONS.BOTH || extension === EXTENSIONS.JS) {
101
- exec(`${coreCommand} --extensions=js,jsx --ignore-pattern='${IGNORE_PATTERN}'`, handleOutput);
102
- }
103
- if (extension === EXTENSIONS.BOTH || extension === EXTENSIONS.TSX) {
104
- exec(
105
- `${coreCommand} --parser=tsx --extensions=tsx --ignore-pattern='${IGNORE_PATTERN}'`,
106
- handleOutput,
107
- );
108
- }
109
- } else {
110
- console.log('👋 Exiting');
111
- }
112
- };
113
-
114
- run();
@@ -1,193 +0,0 @@
1
- import { log } from './utils';
2
-
3
- const TYPE_REPLACEMENTS = {
4
- primary: 'Button.Type.ACCENT',
5
- secondary: 'Button.Type.ACCENT',
6
- link: 'Button.Type.ACCENT',
7
- danger: 'Button.Type.NEGATIVE',
8
- pay: 'Button.Type.POSITIVE',
9
- };
10
-
11
- const PRIORITY_ADDITIONS = {
12
- secondary: 'Button.Priority.SECONDARY',
13
- link: 'Button.Priority.TERTIARY',
14
- danger: 'Button.Priority.SECONDARY',
15
- };
16
-
17
- const transform = (file, api, options) => {
18
- const printOptions = options.printOptions || {
19
- quote: 'single',
20
- trailingComma: true,
21
- };
22
-
23
- const j = api.jscodeshift;
24
- const root = j(file.source);
25
-
26
- log('All aboard the transformation train 🚂', 2);
27
- log(
28
- 'Upgrading instances of Button from @transferwise/components. Please refer to components/upgrades/2021-02-v34-35.js for details.',
29
- 1,
30
- );
31
- log(`Using the ${options.parser} parser.`, 2);
32
-
33
- const literalType = options.parser === 'tsx' ? 'StringLiteral' : 'Literal';
34
-
35
- // First, ensure they are importing Button from our package
36
- const buttonImports = root
37
- .find(j.ImportDeclaration, {
38
- source: {
39
- type: literalType,
40
- value: '@transferwise/components',
41
- },
42
- })
43
- .find(j.Identifier, {
44
- name: 'Button',
45
- });
46
-
47
- if (buttonImports.size() === 0) {
48
- return null;
49
- }
50
-
51
- log('Found import of Button from @transferwise/components, continuing 🛤', 1);
52
-
53
- const buttons = root.findJSXElements('Button');
54
-
55
- log('Adding priorities for literal types', 2);
56
-
57
- // Add in priorities for literal types such as <Button type="secondary"/> => <Button type="secondary" priority={Button.Priority.SECONDARY} />
58
- buttons
59
- .find(j.JSXAttribute, {
60
- name: {
61
- type: 'JSXIdentifier',
62
- name: 'type',
63
- },
64
- value: {
65
- type: 'Literal',
66
- },
67
- })
68
- .replaceWith((nodePath) => {
69
- const priority = PRIORITY_ADDITIONS[nodePath.value.value.value]; // 😅
70
-
71
- if (!priority) {
72
- return nodePath.value;
73
- }
74
-
75
- return [
76
- nodePath.value,
77
- j.jsxAttribute(
78
- j.jsxIdentifier('priority'),
79
- j.jsxExpressionContainer(j.identifier(priority)),
80
- ),
81
- ];
82
- });
83
-
84
- log('Adding priorities for expressive types', 2);
85
-
86
- // Add in priorities for expressive types such as <Button type={Button.Type.SECONDARY}/> => <Button type={Button.Type.SECONDARY} priority={Button.Priority.SECONDARY} />
87
- buttons
88
- .find(j.JSXAttribute, {
89
- name: {
90
- type: 'JSXIdentifier',
91
- name: 'type',
92
- },
93
- value: {
94
- type: 'JSXExpressionContainer',
95
- expression: {
96
- type: 'MemberExpression',
97
- object: {
98
- type: 'MemberExpression',
99
- object: {
100
- name: 'Button',
101
- type: 'Identifier',
102
- },
103
- property: {
104
- name: 'Type',
105
- type: 'Identifier',
106
- },
107
- },
108
- },
109
- },
110
- })
111
- .replaceWith((nodePath) => {
112
- const type = nodePath.value.value.expression.property.name;
113
-
114
- const priority = PRIORITY_ADDITIONS[type.toLowerCase()];
115
-
116
- if (!priority) {
117
- return nodePath.value;
118
- }
119
-
120
- return [
121
- nodePath.value,
122
- j.jsxAttribute(
123
- j.jsxIdentifier('priority'),
124
- j.jsxExpressionContainer(j.identifier(priority)),
125
- ),
126
- ];
127
- });
128
-
129
- log('Replacing deprecated literal types', 2);
130
-
131
- // Replace literal types such as <Button type="primary"/> => <Button type={Button.Type.ACCENT} />
132
- buttons
133
- .find(j.JSXAttribute, {
134
- name: {
135
- type: 'JSXIdentifier',
136
- name: 'type',
137
- },
138
- value: {
139
- type: 'Literal',
140
- },
141
- })
142
- .find(j.Literal)
143
- .replaceWith((nodePath) => {
144
- const type = TYPE_REPLACEMENTS[nodePath.value.value];
145
-
146
- if (!type) {
147
- return nodePath.value;
148
- }
149
-
150
- return j.jsxExpressionContainer(j.identifier(type));
151
- });
152
-
153
- log('Replacing deprecated expressive types', 2);
154
-
155
- // Replace expressive types such as <Button type={Button.Type.PRIMARY}/> => <Button type={Button.Type.ACCENT} />
156
- buttons
157
- .find(j.JSXAttribute, {
158
- name: {
159
- type: 'JSXIdentifier',
160
- name: 'type',
161
- },
162
- value: {
163
- type: 'JSXExpressionContainer',
164
- },
165
- })
166
- .find(j.MemberExpression, {
167
- object: {
168
- type: 'MemberExpression',
169
- object: {
170
- name: 'Button',
171
- type: 'Identifier',
172
- },
173
- property: {
174
- name: 'Type',
175
- type: 'Identifier',
176
- },
177
- },
178
- })
179
- .replaceWith((node) => {
180
- const type = node.value.property.name.toLowerCase();
181
-
182
- if (!TYPE_REPLACEMENTS[type]) {
183
- return node.value;
184
- }
185
- return j.jsxIdentifier(TYPE_REPLACEMENTS[type]);
186
- });
187
-
188
- log('Transformation complete, printing to source.', 1);
189
-
190
- return root.toSource(printOptions);
191
- };
192
-
193
- export default transform;
@@ -1,290 +0,0 @@
1
- /* eslint-disable no-console */
2
- import { componentsPackageName, defaultPrintOptions, getLiteralType } from './utils';
3
-
4
- const Scroll = 'Scroll';
5
- const sizeCase = { old: 'Size', new: 'Size' };
6
- const priorityCase = { old: 'Priority', new: 'Priority' };
7
- const positionCase = { old: 'Position', new: 'Position' };
8
- const monthFormatCase = { old: 'MonthFormat', new: 'MonthFormat' };
9
- const layoutCase = { old: 'Layout', new: 'Layout' };
10
- const statusCase = { old: 'Status', new: 'Status' };
11
-
12
- const breakingChangesMap = [
13
- {
14
- component: 'Avatar',
15
- enums: [sizeCase, { old: 'Type', new: 'AvatarType' }, { old: 'Theme', new: 'Theme' }],
16
- },
17
- {
18
- component: 'Loader',
19
- enums: [sizeCase],
20
- },
21
- {
22
- component: 'Badge',
23
- enums: [sizeCase, { old: 'Border', new: 'Theme' }],
24
- },
25
- {
26
- component: 'Alert',
27
- enums: [
28
- { old: 'Type', new: 'Sentiment' },
29
- { old: 'ArrowPosition', new: 'AlertArrowPosition' },
30
- ],
31
- },
32
- {
33
- component: 'Button',
34
- enums: [priorityCase, sizeCase],
35
- },
36
- {
37
- component: 'Chevron',
38
- enums: [{ old: 'Orientation', new: 'Position' }, sizeCase],
39
- },
40
- {
41
- component: 'CircularButton',
42
- enums: [{ old: 'Type', new: 'ControlType' }, priorityCase],
43
- },
44
- {
45
- component: 'AvatarWrapper',
46
- enums: [{ old: 'ProfileType', new: 'ProfileType' }],
47
- },
48
- {
49
- component: 'DateInput',
50
- enums: [sizeCase, { old: 'DateMode', new: 'DateMode' }, monthFormatCase],
51
- },
52
- {
53
- component: 'DateLookup',
54
- enums: [sizeCase, monthFormatCase],
55
- },
56
- {
57
- component: 'Decision',
58
- enums: [
59
- { old: 'Presentation', new: 'DecisionPresentation' },
60
- { old: 'Type', new: 'DecisionType' },
61
- sizeCase,
62
- ],
63
- },
64
- {
65
- component: 'DefinitionList',
66
- enums: [layoutCase],
67
- },
68
- {
69
- component: 'Drawer',
70
- enums: [positionCase],
71
- },
72
- {
73
- component: 'DynamicFieldDefinitionList',
74
- enums: [layoutCase],
75
- },
76
- {
77
- component: 'Info',
78
- enums: [sizeCase, { old: 'Presentation', new: 'InfoPresentation' }],
79
- },
80
- {
81
- component: 'InlineAlert',
82
- enums: [{ old: 'Type', new: 'Sentiment' }],
83
- },
84
- {
85
- component: 'Modal',
86
- enums: [sizeCase, positionCase, { old: Scroll, new: Scroll }],
87
- },
88
- {
89
- component: 'PhoneNumberInput',
90
- enums: [sizeCase],
91
- },
92
- {
93
- component: 'Popover',
94
- enums: [{ old: 'Placement', new: 'Position' }],
95
- },
96
- {
97
- component: 'ProcessIndicator',
98
- enums: [statusCase, sizeCase],
99
- },
100
- {
101
- component: 'Summary',
102
- enums: [statusCase],
103
- },
104
- {
105
- component: 'Tabs',
106
- enums: [
107
- { old: 'SpacerSizes', new: 'Size' },
108
- { old: 'HeaderWidth', new: 'Width' },
109
- ],
110
- },
111
- {
112
- component: 'Tile',
113
- enums: [sizeCase],
114
- },
115
- {
116
- component: 'Tooltip',
117
- enums: [positionCase],
118
- },
119
- {
120
- component: 'Typeahead',
121
- enums: [sizeCase, { old: 'Type', new: 'Sentiment' }],
122
- },
123
- {
124
- component: 'Upload',
125
- enums: [{ old: 'UploadStep', new: 'UploadStep' }],
126
- },
127
- ];
128
-
129
- const ButtonTypeBreakingChange = {
130
- Type: ['PRIMARY', 'PAY', 'SECONDARY', 'DANGER', 'LINK'],
131
- ControlType: ['ACCENT', 'POSITIVE', 'NEGATIVE'],
132
- };
133
-
134
- export default function codemod(file, api, options) {
135
- const literalType = getLiteralType(options.parser);
136
- const j = api.jscodeshift;
137
- const fileTree = j(file.source);
138
-
139
- let hasModifications = false;
140
- breakingChangesMap.forEach(({ component, enums }) => {
141
- const componentImport = fileTree
142
- .find(j.ImportDeclaration, {
143
- source: {
144
- type: literalType,
145
- value: componentsPackageName,
146
- },
147
- })
148
- .find(j.Identifier, {
149
- name: component,
150
- });
151
-
152
- if (componentImport.size() > 0) {
153
- enums.forEach((enumItem) => {
154
- let newEnum = enumItem.new;
155
- fileTree
156
- .find(j.MemberExpression, {
157
- object: {
158
- type: 'Identifier',
159
- name: component,
160
- },
161
- property: {
162
- type: 'Identifier',
163
- name: enumItem.old,
164
- },
165
- })
166
- .replaceWith((node) => {
167
- hasModifications = true;
168
- // cover Button's edge case
169
- if (component === 'Button') {
170
- const enumItemValue = node.parentPath.node.property.name;
171
- if (
172
- enumItemValue === 'ACCENT' ||
173
- enumItemValue === 'POSITIVE' ||
174
- enumItemValue === 'NEGATIVE'
175
- ) {
176
- // use `ControlType` instead of `Type` in above cases
177
- newEnum = 'ControlType';
178
- }
179
- }
180
- return j.jsxIdentifier(newEnum);
181
- });
182
-
183
- if (hasModifications) {
184
- hasModifications = false;
185
- // check whether we already added this enum into import statement
186
- const enumImports = fileTree
187
- .find(j.ImportDeclaration, {
188
- source: {
189
- type: literalType,
190
- value: componentsPackageName,
191
- },
192
- })
193
- .find(j.Identifier, {
194
- name: newEnum,
195
- });
196
-
197
- if (enumImports.size() === 0) {
198
- // add import for `newEnum`
199
- fileTree
200
- .find(j.ImportDeclaration, {
201
- source: {
202
- type: literalType,
203
- value: componentsPackageName,
204
- },
205
- })
206
- .forEach((paths) => {
207
- paths.value.specifiers.push(j.importSpecifier(j.identifier(newEnum)));
208
- });
209
- }
210
-
211
- // do we still need import component?
212
- const isComponentNotUsedAtJsx =
213
- fileTree
214
- .find(j.JSXElement, {
215
- openingElement: {
216
- name: {
217
- type: 'JSXIdentifier',
218
- name: component,
219
- },
220
- },
221
- })
222
- .size() === 0;
223
-
224
- if (isComponentNotUsedAtJsx) {
225
- // delete component from import statement
226
- fileTree
227
- .find(j.ImportDeclaration, {
228
- source: {
229
- type: literalType,
230
- value: componentsPackageName,
231
- },
232
- })
233
- .find(j.Identifier, {
234
- name: component,
235
- })
236
- .remove();
237
- }
238
- }
239
- });
240
- }
241
- });
242
-
243
- [...ButtonTypeBreakingChange.Type, ...ButtonTypeBreakingChange.ControlType].forEach(
244
- (enumItemValue) => {
245
- fileTree
246
- .find(j.MemberExpression, {
247
- object: {
248
- property: {
249
- name: 'Type',
250
- },
251
- },
252
- property: {
253
- name: enumItemValue,
254
- },
255
- })
256
- .replaceWith(() => {
257
- // eslint-disable-next-line unicorn/prevent-abbreviations -- this is a useless rule, and useless application of it
258
- const newProp = ButtonTypeBreakingChange.Type.includes(enumItemValue)
259
- ? 'Type'
260
- : 'ControlType';
261
-
262
- const enumImports = fileTree
263
- .find(j.ImportDeclaration, {
264
- source: {
265
- type: literalType,
266
- value: componentsPackageName,
267
- },
268
- })
269
- .find(j.Identifier, {
270
- name: newProp,
271
- });
272
- if (enumImports.size() === 0) {
273
- fileTree
274
- .find(j.ImportDeclaration, {
275
- source: {
276
- type: literalType,
277
- value: componentsPackageName,
278
- },
279
- })
280
- .forEach((paths) => {
281
- paths.value.specifiers.push(j.importSpecifier(j.identifier(newProp)));
282
- });
283
- }
284
- return j.jsxIdentifier(`${newProp}.${enumItemValue}`);
285
- });
286
- },
287
- );
288
-
289
- return fileTree.toSource(defaultPrintOptions);
290
- }
@@ -1,17 +0,0 @@
1
- export const componentsPackageName = '@transferwise/components';
2
-
3
- export const defaultPrintOptions = {
4
- quote: 'single',
5
- trailingComma: true,
6
- };
7
-
8
- export function getLiteralType(parser) {
9
- return parser === 'tsx' ? 'StringLiteral' : 'Literal';
10
- }
11
-
12
- export const log = (verbose, message, level = 0) => {
13
- if (verbose >= level) {
14
- // eslint-disable-next-line no-undef
15
- api.report(`✨ ${message}`);
16
- }
17
- };