@atlaskit/eslint-plugin-design-system 10.12.3 → 10.12.4
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.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/rules/no-legacy-icons/checks.js +10 -8
- package/dist/cjs/rules/no-legacy-icons/helpers.js +56 -15
- package/dist/cjs/rules/no-legacy-icons/upcoming-icons.js +7 -0
- package/dist/es2019/rules/no-legacy-icons/checks.js +11 -9
- package/dist/es2019/rules/no-legacy-icons/helpers.js +40 -2
- package/dist/es2019/rules/no-legacy-icons/upcoming-icons.js +1 -0
- package/dist/esm/rules/no-legacy-icons/checks.js +11 -9
- package/dist/esm/rules/no-legacy-icons/helpers.js +55 -14
- package/dist/esm/rules/no-legacy-icons/upcoming-icons.js +1 -0
- package/dist/types/rules/no-legacy-icons/helpers.d.ts +4 -0
- package/dist/types/rules/no-legacy-icons/upcoming-icons.d.ts +1 -0
- package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +4 -0
- package/dist/types-ts4.5/rules/no-legacy-icons/upcoming-icons.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 10.12.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#126974](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/126974)
|
|
8
|
+
[`bf10ab6817404`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bf10ab6817404) -
|
|
9
|
+
Updates the no-legacy-icons eslint rule to account for upcoming icons.
|
|
10
|
+
|
|
3
11
|
## 10.12.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -232,13 +232,14 @@ var createChecks = exports.createChecks = function createChecks(context) {
|
|
|
232
232
|
if (node.name in legacyIconImports && (0, _eslintCodemodUtils.isNodeOfType)(node.parent.parent.name, 'JSXIdentifier') && node.parent.parent.name.name !== 'LEGACY_fallbackIcon') {
|
|
233
233
|
var _migrationMapObject$s;
|
|
234
234
|
var migrationMapObject = (0, _helpers.getMigrationMapObject)(legacyIconImports[node.name].packageName);
|
|
235
|
+
var upcomingIcon = (0, _helpers.getUpcomingIcons)(legacyIconImports[node.name].packageName);
|
|
235
236
|
var newIcon = migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.newIcon;
|
|
236
|
-
var isNewIconMigratable = (0, _helpers.canAutoMigrateNewIconBasedOnSize)(migrationMapObject === null || migrationMapObject === void 0 || (_migrationMapObject$s = migrationMapObject.sizeGuidance) === null || _migrationMapObject$s === void 0 ? void 0 : _migrationMapObject$s.medium);
|
|
237
|
+
var isNewIconMigratable = (0, _helpers.canAutoMigrateNewIconBasedOnSize)(upcomingIcon ? upcomingIcon.sizeGuidance.medium : migrationMapObject === null || migrationMapObject === void 0 || (_migrationMapObject$s = migrationMapObject.sizeGuidance) === null || _migrationMapObject$s === void 0 ? void 0 : _migrationMapObject$s.medium);
|
|
237
238
|
var isInNewButton = (0, _eslintCodemodUtils.isNodeOfType)(node.parent.parent.parent.name, 'JSXIdentifier') && newButtonImports.has(node.parent.parent.parent.name.name);
|
|
238
|
-
if (newIcon && isInNewButton && isNewIconMigratable) {
|
|
239
|
+
if (newIcon && isInNewButton && isNewIconMigratable || upcomingIcon && isInNewButton && isNewIconMigratable) {
|
|
239
240
|
(0, _helpers.createAutoMigrationError)(node, legacyIconImports[node.name].packageName, node.name, errorsAuto);
|
|
240
241
|
guidance[(0, _helpers.locToString)(node)] = (0, _helpers.createGuidance)(legacyIconImports[node.name].packageName, isInNewButton, 'medium');
|
|
241
|
-
} else if (!newIcon || !isNewIconMigratable) {
|
|
242
|
+
} else if (!newIcon && !upcomingIcon || !isNewIconMigratable) {
|
|
242
243
|
(0, _helpers.createCantFindSuitableReplacementError)(node, legacyIconImports[node.name].packageName, node.name, errorsManual);
|
|
243
244
|
guidance[(0, _helpers.locToString)(node)] = (0, _helpers.createGuidance)(legacyIconImports[node.name].packageName, isInNewButton);
|
|
244
245
|
} else if (!isInNewButton) {
|
|
@@ -265,7 +266,7 @@ var createChecks = exports.createChecks = function createChecks(context) {
|
|
|
265
266
|
var name = node.openingElement.name.name;
|
|
266
267
|
// Legacy icons rendered as JSX elements
|
|
267
268
|
if (name in legacyIconImports) {
|
|
268
|
-
var _node$parent2, _node$parent3, _size;
|
|
269
|
+
var _node$parent2, _node$parent3, _size, _size2;
|
|
269
270
|
// Determine if inside a new button - if so:
|
|
270
271
|
// - Assume spread props are safe - still error if props explicitly set to unmigratable values
|
|
271
272
|
var insideNewButton = false;
|
|
@@ -349,12 +350,13 @@ var createChecks = exports.createChecks = function createChecks(context) {
|
|
|
349
350
|
hasManualMigration = true;
|
|
350
351
|
}
|
|
351
352
|
var migrationMapObject = (0, _helpers.getMigrationMapObject)(legacyIconImports[name].packageName);
|
|
353
|
+
var upcomingIcon = (0, _helpers.getUpcomingIcons)(legacyIconImports[name].packageName);
|
|
352
354
|
var newIcon = migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.newIcon;
|
|
353
|
-
var isNewIconMigratable = (0, _helpers.canAutoMigrateNewIconBasedOnSize)(migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.sizeGuidance[(
|
|
354
|
-
if (!hasManualMigration && newIcon && isNewIconMigratable) {
|
|
355
|
+
var isNewIconMigratable = (0, _helpers.canAutoMigrateNewIconBasedOnSize)(upcomingIcon ? upcomingIcon.sizeGuidance[(_size = size) !== null && _size !== void 0 ? _size : 'medium'] : migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.sizeGuidance[(_size2 = size) !== null && _size2 !== void 0 ? _size2 : 'medium']);
|
|
356
|
+
if (!hasManualMigration && (newIcon || upcomingIcon) && isNewIconMigratable) {
|
|
355
357
|
(0, _helpers.createAutoMigrationError)(node, legacyIconImports[name].packageName, name, errorsAuto);
|
|
356
|
-
} else if ((!newIcon || !isNewIconMigratable) && size) {
|
|
357
|
-
(0, _helpers.createCantFindSuitableReplacementError)(node, legacyIconImports[name].packageName, name, errorsManual, migrationMapObject ? true : false);
|
|
358
|
+
} else if ((!newIcon && !upcomingIcon || !isNewIconMigratable) && size) {
|
|
359
|
+
(0, _helpers.createCantFindSuitableReplacementError)(node, legacyIconImports[name].packageName, name, errorsManual, upcomingIcon ? true : migrationMapObject ? true : false);
|
|
358
360
|
}
|
|
359
361
|
guidance[(0, _helpers.locToString)(node)] = (0, _helpers.createGuidance)(legacyIconImports[name].packageName, insideNewButton, size && (0, _helpers.isSize)(size) ? size : undefined);
|
|
360
362
|
}
|
|
@@ -5,11 +5,12 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.locToString = exports.isSize = exports.getMigrationMapObject = exports.getLiteralStringValue = exports.createHelpers = exports.createGuidance = exports.createCantMigrateSpreadPropsError = exports.createCantMigrateSizeUnknown = exports.createCantMigrateReExportError = exports.createCantMigrateIdentifierError = exports.createCantMigrateFunctionUnknownError = exports.createCantMigrateColorError = exports.createCantFindSuitableReplacementError = exports.createAutoMigrationError = exports.canMigrateColor = exports.canAutoMigrateNewIconBasedOnSize = void 0;
|
|
8
|
+
exports.locToString = exports.isSize = exports.getUpcomingIcons = exports.getMigrationMapObject = exports.getLiteralStringValue = exports.createHelpers = exports.createGuidance = exports.createCantMigrateSpreadPropsError = exports.createCantMigrateSizeUnknown = exports.createCantMigrateReExportError = exports.createCantMigrateIdentifierError = exports.createCantMigrateFunctionUnknownError = exports.createCantMigrateColorError = exports.createCantFindSuitableReplacementError = exports.createAutoMigrationError = exports.canMigrateColor = exports.canAutoMigrateNewIconBasedOnSize = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
11
11
|
var _UNSAFE_migrationMap = _interopRequireWildcard(require("@atlaskit/icon/UNSAFE_migration-map"));
|
|
12
12
|
var _getImportName = require("../utils/get-import-name");
|
|
13
|
+
var _upcomingIcons = require("./upcoming-icons");
|
|
13
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
16
|
var sizes = ['small', 'medium', 'large', 'xlarge'];
|
|
@@ -24,11 +25,26 @@ var isSize = exports.isSize = function isSize(size) {
|
|
|
24
25
|
*/
|
|
25
26
|
var getMigrationMapObject = exports.getMigrationMapObject = function getMigrationMapObject(iconPackage) {
|
|
26
27
|
var key = getIconKey(iconPackage);
|
|
27
|
-
if (
|
|
28
|
+
if (Object.keys(_UNSAFE_migrationMap.default).includes(key)) {
|
|
28
29
|
return _UNSAFE_migrationMap.default[key];
|
|
29
30
|
}
|
|
30
31
|
return null;
|
|
31
32
|
};
|
|
33
|
+
var getUpcomingIcons = exports.getUpcomingIcons = function getUpcomingIcons(iconPackage) {
|
|
34
|
+
var key = getIconKey(iconPackage);
|
|
35
|
+
if (_upcomingIcons.upcomingIcons.includes(key)) {
|
|
36
|
+
var retval = {
|
|
37
|
+
sizeGuidance: {
|
|
38
|
+
small: 'swap',
|
|
39
|
+
medium: 'swap',
|
|
40
|
+
large: 'icon-tile',
|
|
41
|
+
xlarge: 'icon-tile'
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return retval;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
};
|
|
32
48
|
|
|
33
49
|
/**
|
|
34
50
|
* Returns the key of a legacy icon
|
|
@@ -54,42 +70,67 @@ var createGuidance = exports.createGuidance = function createGuidance(iconPackag
|
|
|
54
70
|
var insideNewButton = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
55
71
|
var size = arguments.length > 2 ? arguments[2] : undefined;
|
|
56
72
|
var migrationMapObject = getMigrationMapObject(iconPackage);
|
|
57
|
-
|
|
73
|
+
var upcomingIcon = getUpcomingIcons(iconPackage);
|
|
74
|
+
if (upcomingIcon) {
|
|
75
|
+
var guidance = '';
|
|
76
|
+
if (size) {
|
|
77
|
+
if (upcomingIcon.sizeGuidance[size] && canAutoMigrateNewIconBasedOnSize(upcomingIcon.sizeGuidance[size])) {
|
|
78
|
+
guidance += "Fix: An upcoming icon release is planned to migrate this legacy icon.";
|
|
79
|
+
} else {
|
|
80
|
+
guidance += "No equivalent icon for this size, ".concat(size, ", in the current or upcoming set of icons.");
|
|
81
|
+
}
|
|
82
|
+
guidance += "".concat(Object.keys(_UNSAFE_migrationMap.migrationOutcomeDescriptionMap).includes(upcomingIcon.sizeGuidance[size]) ? " Once the upcoming icons are released, please: ".concat(_UNSAFE_migrationMap.migrationOutcomeDescriptionMap[upcomingIcon.sizeGuidance[size]]) : ' No migration size advice given.', "\n");
|
|
83
|
+
} else {
|
|
84
|
+
guidance = "Please wait for the upcoming icons released, as it will contain an alternative for this legacy icon.\nMigration suggestions, depending on the legacy icon size:\n";
|
|
85
|
+
for (var _i = 0, _Object$entries = Object.entries(upcomingIcon.sizeGuidance); _i < _Object$entries.length; _i++) {
|
|
86
|
+
var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
|
|
87
|
+
_size = _Object$entries$_i[0],
|
|
88
|
+
value = _Object$entries$_i[1];
|
|
89
|
+
guidance += "\t- ".concat(_size, ": ");
|
|
90
|
+
if (!Object.keys(_UNSAFE_migrationMap.migrationOutcomeDescriptionMap).includes(value)) {
|
|
91
|
+
guidance += 'No migration advice given.\n';
|
|
92
|
+
} else {
|
|
93
|
+
guidance += "".concat(_UNSAFE_migrationMap.migrationOutcomeDescriptionMap[value], ".\n");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return guidance;
|
|
98
|
+
} else if (migrationMapObject) {
|
|
58
99
|
var newIcon = migrationMapObject.newIcon;
|
|
59
100
|
if (!newIcon) {
|
|
60
101
|
return 'No equivalent icon in new set. An option is to contribute a custom icon into icon-labs package instead.\n';
|
|
61
102
|
}
|
|
62
103
|
var buttonGuidanceStr = "Please set 'spacing' property of the new icon to 'none', to ensure appropriate spacing inside `@atlaskit/button`.\n";
|
|
63
|
-
var
|
|
104
|
+
var _guidance = '';
|
|
64
105
|
if (size) {
|
|
65
106
|
if (migrationMapObject.sizeGuidance[size] && canAutoMigrateNewIconBasedOnSize(migrationMapObject.sizeGuidance[size])) {
|
|
66
|
-
|
|
107
|
+
_guidance += "Fix: Use ".concat(newIcon.name, " from ").concat(newIcon.package, "/").concat(newIcon.type, "/").concat(newIcon.name, " instead.");
|
|
67
108
|
} else {
|
|
68
|
-
|
|
109
|
+
_guidance += "No equivalent icon for this size, ".concat(size, ", in new set.");
|
|
69
110
|
}
|
|
70
|
-
|
|
111
|
+
_guidance += "".concat(migrationMapObject.sizeGuidance[size] in _UNSAFE_migrationMap.migrationOutcomeDescriptionMap ? " Please: ".concat(_UNSAFE_migrationMap.migrationOutcomeDescriptionMap[migrationMapObject.sizeGuidance[size]]) : ' No migration size advice given.', "\n");
|
|
71
112
|
} else {
|
|
72
|
-
|
|
113
|
+
_guidance = "Use ".concat(newIcon.name, " from ").concat(newIcon.package, "/").concat(newIcon.type, "/").concat(newIcon.name, " instead.\nMigration suggestions, depending on the legacy icon size:\n");
|
|
73
114
|
Object.entries(migrationMapObject.sizeGuidance).forEach(function (_ref) {
|
|
74
115
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
75
116
|
size = _ref2[0],
|
|
76
117
|
value = _ref2[1];
|
|
77
|
-
|
|
118
|
+
_guidance += "\t- ".concat(size, ": ");
|
|
78
119
|
if (!(value in _UNSAFE_migrationMap.migrationOutcomeDescriptionMap)) {
|
|
79
|
-
|
|
120
|
+
_guidance += 'No migration advice given.\n';
|
|
80
121
|
} else {
|
|
81
|
-
|
|
122
|
+
_guidance += "".concat(_UNSAFE_migrationMap.migrationOutcomeDescriptionMap[value], ".\n");
|
|
82
123
|
}
|
|
83
124
|
});
|
|
84
125
|
}
|
|
85
126
|
if (insideNewButton) {
|
|
86
|
-
|
|
127
|
+
_guidance += buttonGuidanceStr;
|
|
87
128
|
} else if (size && size === 'medium') {
|
|
88
|
-
|
|
129
|
+
_guidance += "Setting the spacing property to 'spacious' will maintain the icon's box dimensions - but consider setting spacing='none' as it allows for easier control of spacing by parent elements.\n";
|
|
89
130
|
} else if (size) {
|
|
90
|
-
|
|
131
|
+
_guidance += "In the new icon, please use spacing='none'.\n";
|
|
91
132
|
}
|
|
92
|
-
return
|
|
133
|
+
return _guidance;
|
|
93
134
|
} else {
|
|
94
135
|
return "Migration suggestions not found for \"".concat(iconPackage, "\".\n");
|
|
95
136
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.upcomingIcons = void 0;
|
|
7
|
+
var upcomingIcons = exports.upcomingIcons = ['app-switcher', 'check-circle-outline', 'export', 'file', 'flag-filled', 'lightbulb-filled', 'lock-filled', 'menu-expand', 'menu', 'notification-direct', 'notification', 'people-group', 'people', 'refresh', 'switcher', 'editor/align-image-center', 'editor/align-image-left', 'editor/align-image-right', 'editor/background-color', 'editor/bold', 'editor/indent', 'editor/italic', 'editor/horizontal-rule', 'editor-layout-three-equal', 'editor-layout-three-with-sidebars', 'editor/layout-two-equal', 'editor/layout-two-left-sidebars', 'editor/layout-two-right-sidebar', 'editor/media-center', 'editor/media-full-width', 'editor/media-wide', 'editor/number-list', 'emoji/activity', 'editor/file', 'emoji/flags', 'emoji/food', 'emoji/nature', 'emoji/people', 'emoji/productivity', 'emoji/travel', 'bitbucket/repos'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
-
import { canAutoMigrateNewIconBasedOnSize, canMigrateColor, createAutoMigrationError, createCantFindSuitableReplacementError, createCantMigrateColorError, createCantMigrateFunctionUnknownError, createCantMigrateIdentifierError, createCantMigrateReExportError, createCantMigrateSizeUnknown, createCantMigrateSpreadPropsError, createGuidance, createHelpers, getMigrationMapObject, isSize, locToString } from './helpers';
|
|
2
|
+
import { canAutoMigrateNewIconBasedOnSize, canMigrateColor, createAutoMigrationError, createCantFindSuitableReplacementError, createCantMigrateColorError, createCantMigrateFunctionUnknownError, createCantMigrateIdentifierError, createCantMigrateReExportError, createCantMigrateSizeUnknown, createCantMigrateSpreadPropsError, createGuidance, createHelpers, getMigrationMapObject, getUpcomingIcons, isSize, locToString } from './helpers';
|
|
3
3
|
export const createChecks = context => {
|
|
4
4
|
//create global variables to be shared by the checks
|
|
5
5
|
const {
|
|
@@ -164,13 +164,14 @@ export const createChecks = context => {
|
|
|
164
164
|
if (node.name in legacyIconImports && isNodeOfType(node.parent.parent.name, 'JSXIdentifier') && node.parent.parent.name.name !== 'LEGACY_fallbackIcon') {
|
|
165
165
|
var _migrationMapObject$s;
|
|
166
166
|
const migrationMapObject = getMigrationMapObject(legacyIconImports[node.name].packageName);
|
|
167
|
+
const upcomingIcon = getUpcomingIcons(legacyIconImports[node.name].packageName);
|
|
167
168
|
const newIcon = migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.newIcon;
|
|
168
|
-
const isNewIconMigratable = canAutoMigrateNewIconBasedOnSize(migrationMapObject === null || migrationMapObject === void 0 ? void 0 : (_migrationMapObject$s = migrationMapObject.sizeGuidance) === null || _migrationMapObject$s === void 0 ? void 0 : _migrationMapObject$s.medium);
|
|
169
|
+
const isNewIconMigratable = canAutoMigrateNewIconBasedOnSize(upcomingIcon ? upcomingIcon.sizeGuidance.medium : migrationMapObject === null || migrationMapObject === void 0 ? void 0 : (_migrationMapObject$s = migrationMapObject.sizeGuidance) === null || _migrationMapObject$s === void 0 ? void 0 : _migrationMapObject$s.medium);
|
|
169
170
|
const isInNewButton = isNodeOfType(node.parent.parent.parent.name, 'JSXIdentifier') && newButtonImports.has(node.parent.parent.parent.name.name);
|
|
170
|
-
if (newIcon && isInNewButton && isNewIconMigratable) {
|
|
171
|
+
if (newIcon && isInNewButton && isNewIconMigratable || upcomingIcon && isInNewButton && isNewIconMigratable) {
|
|
171
172
|
createAutoMigrationError(node, legacyIconImports[node.name].packageName, node.name, errorsAuto);
|
|
172
173
|
guidance[locToString(node)] = createGuidance(legacyIconImports[node.name].packageName, isInNewButton, 'medium');
|
|
173
|
-
} else if (!newIcon || !isNewIconMigratable) {
|
|
174
|
+
} else if (!newIcon && !upcomingIcon || !isNewIconMigratable) {
|
|
174
175
|
createCantFindSuitableReplacementError(node, legacyIconImports[node.name].packageName, node.name, errorsManual);
|
|
175
176
|
guidance[locToString(node)] = createGuidance(legacyIconImports[node.name].packageName, isInNewButton);
|
|
176
177
|
} else if (!isInNewButton) {
|
|
@@ -197,7 +198,7 @@ export const createChecks = context => {
|
|
|
197
198
|
const name = node.openingElement.name.name;
|
|
198
199
|
// Legacy icons rendered as JSX elements
|
|
199
200
|
if (name in legacyIconImports) {
|
|
200
|
-
var _node$parent2, _node$parent2$parent, _node$parent3, _node$parent3$parent, _node$parent3$parent$, _size;
|
|
201
|
+
var _node$parent2, _node$parent2$parent, _node$parent3, _node$parent3$parent, _node$parent3$parent$, _size, _size2;
|
|
201
202
|
// Determine if inside a new button - if so:
|
|
202
203
|
// - Assume spread props are safe - still error if props explicitly set to unmigratable values
|
|
203
204
|
let insideNewButton = false;
|
|
@@ -268,12 +269,13 @@ export const createChecks = context => {
|
|
|
268
269
|
hasManualMigration = true;
|
|
269
270
|
}
|
|
270
271
|
const migrationMapObject = getMigrationMapObject(legacyIconImports[name].packageName);
|
|
272
|
+
const upcomingIcon = getUpcomingIcons(legacyIconImports[name].packageName);
|
|
271
273
|
const newIcon = migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.newIcon;
|
|
272
|
-
const isNewIconMigratable = canAutoMigrateNewIconBasedOnSize(migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.sizeGuidance[(
|
|
273
|
-
if (!hasManualMigration && newIcon && isNewIconMigratable) {
|
|
274
|
+
const isNewIconMigratable = canAutoMigrateNewIconBasedOnSize(upcomingIcon ? upcomingIcon.sizeGuidance[(_size = size) !== null && _size !== void 0 ? _size : 'medium'] : migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.sizeGuidance[(_size2 = size) !== null && _size2 !== void 0 ? _size2 : 'medium']);
|
|
275
|
+
if (!hasManualMigration && (newIcon || upcomingIcon) && isNewIconMigratable) {
|
|
274
276
|
createAutoMigrationError(node, legacyIconImports[name].packageName, name, errorsAuto);
|
|
275
|
-
} else if ((!newIcon || !isNewIconMigratable) && size) {
|
|
276
|
-
createCantFindSuitableReplacementError(node, legacyIconImports[name].packageName, name, errorsManual, migrationMapObject ? true : false);
|
|
277
|
+
} else if ((!newIcon && !upcomingIcon || !isNewIconMigratable) && size) {
|
|
278
|
+
createCantFindSuitableReplacementError(node, legacyIconImports[name].packageName, name, errorsManual, upcomingIcon ? true : migrationMapObject ? true : false);
|
|
277
279
|
}
|
|
278
280
|
guidance[locToString(node)] = createGuidance(legacyIconImports[name].packageName, insideNewButton, size && isSize(size) ? size : undefined);
|
|
279
281
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
2
|
import baseMigrationMap, { migrationOutcomeDescriptionMap } from '@atlaskit/icon/UNSAFE_migration-map';
|
|
3
3
|
import { getImportName } from '../utils/get-import-name';
|
|
4
|
+
import { upcomingIcons } from './upcoming-icons';
|
|
4
5
|
const sizes = ['small', 'medium', 'large', 'xlarge'];
|
|
5
6
|
export const isSize = size => sizes.includes(size);
|
|
6
7
|
|
|
@@ -11,11 +12,26 @@ export const isSize = size => sizes.includes(size);
|
|
|
11
12
|
*/
|
|
12
13
|
export const getMigrationMapObject = iconPackage => {
|
|
13
14
|
const key = getIconKey(iconPackage);
|
|
14
|
-
if (
|
|
15
|
+
if (Object.keys(baseMigrationMap).includes(key)) {
|
|
15
16
|
return baseMigrationMap[key];
|
|
16
17
|
}
|
|
17
18
|
return null;
|
|
18
19
|
};
|
|
20
|
+
export const getUpcomingIcons = iconPackage => {
|
|
21
|
+
const key = getIconKey(iconPackage);
|
|
22
|
+
if (upcomingIcons.includes(key)) {
|
|
23
|
+
const retval = {
|
|
24
|
+
sizeGuidance: {
|
|
25
|
+
small: 'swap',
|
|
26
|
+
medium: 'swap',
|
|
27
|
+
large: 'icon-tile',
|
|
28
|
+
xlarge: 'icon-tile'
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return retval;
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
};
|
|
19
35
|
|
|
20
36
|
/**
|
|
21
37
|
* Returns the key of a legacy icon
|
|
@@ -39,7 +55,29 @@ export const canAutoMigrateNewIconBasedOnSize = guidance => {
|
|
|
39
55
|
*/
|
|
40
56
|
export const createGuidance = (iconPackage, insideNewButton = false, size) => {
|
|
41
57
|
const migrationMapObject = getMigrationMapObject(iconPackage);
|
|
42
|
-
|
|
58
|
+
const upcomingIcon = getUpcomingIcons(iconPackage);
|
|
59
|
+
if (upcomingIcon) {
|
|
60
|
+
let guidance = '';
|
|
61
|
+
if (size) {
|
|
62
|
+
if (upcomingIcon.sizeGuidance[size] && canAutoMigrateNewIconBasedOnSize(upcomingIcon.sizeGuidance[size])) {
|
|
63
|
+
guidance += `Fix: An upcoming icon release is planned to migrate this legacy icon.`;
|
|
64
|
+
} else {
|
|
65
|
+
guidance += `No equivalent icon for this size, ${size}, in the current or upcoming set of icons.`;
|
|
66
|
+
}
|
|
67
|
+
guidance += `${Object.keys(migrationOutcomeDescriptionMap).includes(upcomingIcon.sizeGuidance[size]) ? ` Once the upcoming icons are released, please: ${migrationOutcomeDescriptionMap[upcomingIcon.sizeGuidance[size]]}` : ' No migration size advice given.'}\n`;
|
|
68
|
+
} else {
|
|
69
|
+
guidance = `Please wait for the upcoming icons released, as it will contain an alternative for this legacy icon.\nMigration suggestions, depending on the legacy icon size:\n`;
|
|
70
|
+
for (const [size, value] of Object.entries(upcomingIcon.sizeGuidance)) {
|
|
71
|
+
guidance += `\t- ${size}: `;
|
|
72
|
+
if (!Object.keys(migrationOutcomeDescriptionMap).includes(value)) {
|
|
73
|
+
guidance += 'No migration advice given.\n';
|
|
74
|
+
} else {
|
|
75
|
+
guidance += `${migrationOutcomeDescriptionMap[value]}.\n`;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return guidance;
|
|
80
|
+
} else if (migrationMapObject) {
|
|
43
81
|
const newIcon = migrationMapObject.newIcon;
|
|
44
82
|
if (!newIcon) {
|
|
45
83
|
return 'No equivalent icon in new set. An option is to contribute a custom icon into icon-labs package instead.\n';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const upcomingIcons = ['app-switcher', 'check-circle-outline', 'export', 'file', 'flag-filled', 'lightbulb-filled', 'lock-filled', 'menu-expand', 'menu', 'notification-direct', 'notification', 'people-group', 'people', 'refresh', 'switcher', 'editor/align-image-center', 'editor/align-image-left', 'editor/align-image-right', 'editor/background-color', 'editor/bold', 'editor/indent', 'editor/italic', 'editor/horizontal-rule', 'editor-layout-three-equal', 'editor-layout-three-with-sidebars', 'editor/layout-two-equal', 'editor/layout-two-left-sidebars', 'editor/layout-two-right-sidebar', 'editor/media-center', 'editor/media-full-width', 'editor/media-wide', 'editor/number-list', 'emoji/activity', 'editor/file', 'emoji/flags', 'emoji/food', 'emoji/nature', 'emoji/people', 'emoji/productivity', 'emoji/travel', 'bitbucket/repos'];
|
|
@@ -3,7 +3,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
|
|
|
3
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
5
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
6
|
-
import { canAutoMigrateNewIconBasedOnSize, canMigrateColor, createAutoMigrationError, createCantFindSuitableReplacementError, createCantMigrateColorError, createCantMigrateFunctionUnknownError, createCantMigrateIdentifierError, createCantMigrateReExportError, createCantMigrateSizeUnknown, createCantMigrateSpreadPropsError, createGuidance, createHelpers, getMigrationMapObject, isSize, locToString } from './helpers';
|
|
6
|
+
import { canAutoMigrateNewIconBasedOnSize, canMigrateColor, createAutoMigrationError, createCantFindSuitableReplacementError, createCantMigrateColorError, createCantMigrateFunctionUnknownError, createCantMigrateIdentifierError, createCantMigrateReExportError, createCantMigrateSizeUnknown, createCantMigrateSpreadPropsError, createGuidance, createHelpers, getMigrationMapObject, getUpcomingIcons, isSize, locToString } from './helpers';
|
|
7
7
|
export var createChecks = function createChecks(context) {
|
|
8
8
|
//create global variables to be shared by the checks
|
|
9
9
|
var _createHelpers = createHelpers(context),
|
|
@@ -225,13 +225,14 @@ export var createChecks = function createChecks(context) {
|
|
|
225
225
|
if (node.name in legacyIconImports && isNodeOfType(node.parent.parent.name, 'JSXIdentifier') && node.parent.parent.name.name !== 'LEGACY_fallbackIcon') {
|
|
226
226
|
var _migrationMapObject$s;
|
|
227
227
|
var migrationMapObject = getMigrationMapObject(legacyIconImports[node.name].packageName);
|
|
228
|
+
var upcomingIcon = getUpcomingIcons(legacyIconImports[node.name].packageName);
|
|
228
229
|
var newIcon = migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.newIcon;
|
|
229
|
-
var isNewIconMigratable = canAutoMigrateNewIconBasedOnSize(migrationMapObject === null || migrationMapObject === void 0 || (_migrationMapObject$s = migrationMapObject.sizeGuidance) === null || _migrationMapObject$s === void 0 ? void 0 : _migrationMapObject$s.medium);
|
|
230
|
+
var isNewIconMigratable = canAutoMigrateNewIconBasedOnSize(upcomingIcon ? upcomingIcon.sizeGuidance.medium : migrationMapObject === null || migrationMapObject === void 0 || (_migrationMapObject$s = migrationMapObject.sizeGuidance) === null || _migrationMapObject$s === void 0 ? void 0 : _migrationMapObject$s.medium);
|
|
230
231
|
var isInNewButton = isNodeOfType(node.parent.parent.parent.name, 'JSXIdentifier') && newButtonImports.has(node.parent.parent.parent.name.name);
|
|
231
|
-
if (newIcon && isInNewButton && isNewIconMigratable) {
|
|
232
|
+
if (newIcon && isInNewButton && isNewIconMigratable || upcomingIcon && isInNewButton && isNewIconMigratable) {
|
|
232
233
|
createAutoMigrationError(node, legacyIconImports[node.name].packageName, node.name, errorsAuto);
|
|
233
234
|
guidance[locToString(node)] = createGuidance(legacyIconImports[node.name].packageName, isInNewButton, 'medium');
|
|
234
|
-
} else if (!newIcon || !isNewIconMigratable) {
|
|
235
|
+
} else if (!newIcon && !upcomingIcon || !isNewIconMigratable) {
|
|
235
236
|
createCantFindSuitableReplacementError(node, legacyIconImports[node.name].packageName, node.name, errorsManual);
|
|
236
237
|
guidance[locToString(node)] = createGuidance(legacyIconImports[node.name].packageName, isInNewButton);
|
|
237
238
|
} else if (!isInNewButton) {
|
|
@@ -258,7 +259,7 @@ export var createChecks = function createChecks(context) {
|
|
|
258
259
|
var name = node.openingElement.name.name;
|
|
259
260
|
// Legacy icons rendered as JSX elements
|
|
260
261
|
if (name in legacyIconImports) {
|
|
261
|
-
var _node$parent2, _node$parent3, _size;
|
|
262
|
+
var _node$parent2, _node$parent3, _size, _size2;
|
|
262
263
|
// Determine if inside a new button - if so:
|
|
263
264
|
// - Assume spread props are safe - still error if props explicitly set to unmigratable values
|
|
264
265
|
var insideNewButton = false;
|
|
@@ -342,12 +343,13 @@ export var createChecks = function createChecks(context) {
|
|
|
342
343
|
hasManualMigration = true;
|
|
343
344
|
}
|
|
344
345
|
var migrationMapObject = getMigrationMapObject(legacyIconImports[name].packageName);
|
|
346
|
+
var upcomingIcon = getUpcomingIcons(legacyIconImports[name].packageName);
|
|
345
347
|
var newIcon = migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.newIcon;
|
|
346
|
-
var isNewIconMigratable = canAutoMigrateNewIconBasedOnSize(migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.sizeGuidance[(
|
|
347
|
-
if (!hasManualMigration && newIcon && isNewIconMigratable) {
|
|
348
|
+
var isNewIconMigratable = canAutoMigrateNewIconBasedOnSize(upcomingIcon ? upcomingIcon.sizeGuidance[(_size = size) !== null && _size !== void 0 ? _size : 'medium'] : migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.sizeGuidance[(_size2 = size) !== null && _size2 !== void 0 ? _size2 : 'medium']);
|
|
349
|
+
if (!hasManualMigration && (newIcon || upcomingIcon) && isNewIconMigratable) {
|
|
348
350
|
createAutoMigrationError(node, legacyIconImports[name].packageName, name, errorsAuto);
|
|
349
|
-
} else if ((!newIcon || !isNewIconMigratable) && size) {
|
|
350
|
-
createCantFindSuitableReplacementError(node, legacyIconImports[name].packageName, name, errorsManual, migrationMapObject ? true : false);
|
|
351
|
+
} else if ((!newIcon && !upcomingIcon || !isNewIconMigratable) && size) {
|
|
352
|
+
createCantFindSuitableReplacementError(node, legacyIconImports[name].packageName, name, errorsManual, upcomingIcon ? true : migrationMapObject ? true : false);
|
|
351
353
|
}
|
|
352
354
|
guidance[locToString(node)] = createGuidance(legacyIconImports[name].packageName, insideNewButton, size && isSize(size) ? size : undefined);
|
|
353
355
|
}
|
|
@@ -2,6 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
3
3
|
import baseMigrationMap, { migrationOutcomeDescriptionMap } from '@atlaskit/icon/UNSAFE_migration-map';
|
|
4
4
|
import { getImportName } from '../utils/get-import-name';
|
|
5
|
+
import { upcomingIcons } from './upcoming-icons';
|
|
5
6
|
var sizes = ['small', 'medium', 'large', 'xlarge'];
|
|
6
7
|
export var isSize = function isSize(size) {
|
|
7
8
|
return sizes.includes(size);
|
|
@@ -14,11 +15,26 @@ export var isSize = function isSize(size) {
|
|
|
14
15
|
*/
|
|
15
16
|
export var getMigrationMapObject = function getMigrationMapObject(iconPackage) {
|
|
16
17
|
var key = getIconKey(iconPackage);
|
|
17
|
-
if (
|
|
18
|
+
if (Object.keys(baseMigrationMap).includes(key)) {
|
|
18
19
|
return baseMigrationMap[key];
|
|
19
20
|
}
|
|
20
21
|
return null;
|
|
21
22
|
};
|
|
23
|
+
export var getUpcomingIcons = function getUpcomingIcons(iconPackage) {
|
|
24
|
+
var key = getIconKey(iconPackage);
|
|
25
|
+
if (upcomingIcons.includes(key)) {
|
|
26
|
+
var retval = {
|
|
27
|
+
sizeGuidance: {
|
|
28
|
+
small: 'swap',
|
|
29
|
+
medium: 'swap',
|
|
30
|
+
large: 'icon-tile',
|
|
31
|
+
xlarge: 'icon-tile'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return retval;
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
};
|
|
22
38
|
|
|
23
39
|
/**
|
|
24
40
|
* Returns the key of a legacy icon
|
|
@@ -44,42 +60,67 @@ export var createGuidance = function createGuidance(iconPackage) {
|
|
|
44
60
|
var insideNewButton = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
45
61
|
var size = arguments.length > 2 ? arguments[2] : undefined;
|
|
46
62
|
var migrationMapObject = getMigrationMapObject(iconPackage);
|
|
47
|
-
|
|
63
|
+
var upcomingIcon = getUpcomingIcons(iconPackage);
|
|
64
|
+
if (upcomingIcon) {
|
|
65
|
+
var guidance = '';
|
|
66
|
+
if (size) {
|
|
67
|
+
if (upcomingIcon.sizeGuidance[size] && canAutoMigrateNewIconBasedOnSize(upcomingIcon.sizeGuidance[size])) {
|
|
68
|
+
guidance += "Fix: An upcoming icon release is planned to migrate this legacy icon.";
|
|
69
|
+
} else {
|
|
70
|
+
guidance += "No equivalent icon for this size, ".concat(size, ", in the current or upcoming set of icons.");
|
|
71
|
+
}
|
|
72
|
+
guidance += "".concat(Object.keys(migrationOutcomeDescriptionMap).includes(upcomingIcon.sizeGuidance[size]) ? " Once the upcoming icons are released, please: ".concat(migrationOutcomeDescriptionMap[upcomingIcon.sizeGuidance[size]]) : ' No migration size advice given.', "\n");
|
|
73
|
+
} else {
|
|
74
|
+
guidance = "Please wait for the upcoming icons released, as it will contain an alternative for this legacy icon.\nMigration suggestions, depending on the legacy icon size:\n";
|
|
75
|
+
for (var _i = 0, _Object$entries = Object.entries(upcomingIcon.sizeGuidance); _i < _Object$entries.length; _i++) {
|
|
76
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
77
|
+
_size = _Object$entries$_i[0],
|
|
78
|
+
value = _Object$entries$_i[1];
|
|
79
|
+
guidance += "\t- ".concat(_size, ": ");
|
|
80
|
+
if (!Object.keys(migrationOutcomeDescriptionMap).includes(value)) {
|
|
81
|
+
guidance += 'No migration advice given.\n';
|
|
82
|
+
} else {
|
|
83
|
+
guidance += "".concat(migrationOutcomeDescriptionMap[value], ".\n");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return guidance;
|
|
88
|
+
} else if (migrationMapObject) {
|
|
48
89
|
var newIcon = migrationMapObject.newIcon;
|
|
49
90
|
if (!newIcon) {
|
|
50
91
|
return 'No equivalent icon in new set. An option is to contribute a custom icon into icon-labs package instead.\n';
|
|
51
92
|
}
|
|
52
93
|
var buttonGuidanceStr = "Please set 'spacing' property of the new icon to 'none', to ensure appropriate spacing inside `@atlaskit/button`.\n";
|
|
53
|
-
var
|
|
94
|
+
var _guidance = '';
|
|
54
95
|
if (size) {
|
|
55
96
|
if (migrationMapObject.sizeGuidance[size] && canAutoMigrateNewIconBasedOnSize(migrationMapObject.sizeGuidance[size])) {
|
|
56
|
-
|
|
97
|
+
_guidance += "Fix: Use ".concat(newIcon.name, " from ").concat(newIcon.package, "/").concat(newIcon.type, "/").concat(newIcon.name, " instead.");
|
|
57
98
|
} else {
|
|
58
|
-
|
|
99
|
+
_guidance += "No equivalent icon for this size, ".concat(size, ", in new set.");
|
|
59
100
|
}
|
|
60
|
-
|
|
101
|
+
_guidance += "".concat(migrationMapObject.sizeGuidance[size] in migrationOutcomeDescriptionMap ? " Please: ".concat(migrationOutcomeDescriptionMap[migrationMapObject.sizeGuidance[size]]) : ' No migration size advice given.', "\n");
|
|
61
102
|
} else {
|
|
62
|
-
|
|
103
|
+
_guidance = "Use ".concat(newIcon.name, " from ").concat(newIcon.package, "/").concat(newIcon.type, "/").concat(newIcon.name, " instead.\nMigration suggestions, depending on the legacy icon size:\n");
|
|
63
104
|
Object.entries(migrationMapObject.sizeGuidance).forEach(function (_ref) {
|
|
64
105
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
65
106
|
size = _ref2[0],
|
|
66
107
|
value = _ref2[1];
|
|
67
|
-
|
|
108
|
+
_guidance += "\t- ".concat(size, ": ");
|
|
68
109
|
if (!(value in migrationOutcomeDescriptionMap)) {
|
|
69
|
-
|
|
110
|
+
_guidance += 'No migration advice given.\n';
|
|
70
111
|
} else {
|
|
71
|
-
|
|
112
|
+
_guidance += "".concat(migrationOutcomeDescriptionMap[value], ".\n");
|
|
72
113
|
}
|
|
73
114
|
});
|
|
74
115
|
}
|
|
75
116
|
if (insideNewButton) {
|
|
76
|
-
|
|
117
|
+
_guidance += buttonGuidanceStr;
|
|
77
118
|
} else if (size && size === 'medium') {
|
|
78
|
-
|
|
119
|
+
_guidance += "Setting the spacing property to 'spacious' will maintain the icon's box dimensions - but consider setting spacing='none' as it allows for easier control of spacing by parent elements.\n";
|
|
79
120
|
} else if (size) {
|
|
80
|
-
|
|
121
|
+
_guidance += "In the new icon, please use spacing='none'.\n";
|
|
81
122
|
}
|
|
82
|
-
return
|
|
123
|
+
return _guidance;
|
|
83
124
|
} else {
|
|
84
125
|
return "Migration suggestions not found for \"".concat(iconPackage, "\".\n");
|
|
85
126
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var upcomingIcons = ['app-switcher', 'check-circle-outline', 'export', 'file', 'flag-filled', 'lightbulb-filled', 'lock-filled', 'menu-expand', 'menu', 'notification-direct', 'notification', 'people-group', 'people', 'refresh', 'switcher', 'editor/align-image-center', 'editor/align-image-left', 'editor/align-image-right', 'editor/background-color', 'editor/bold', 'editor/indent', 'editor/italic', 'editor/horizontal-rule', 'editor-layout-three-equal', 'editor-layout-three-with-sidebars', 'editor/layout-two-equal', 'editor/layout-two-left-sidebars', 'editor/layout-two-right-sidebar', 'editor/media-center', 'editor/media-full-width', 'editor/media-wide', 'editor/number-list', 'emoji/activity', 'editor/file', 'emoji/flags', 'emoji/food', 'emoji/nature', 'emoji/people', 'emoji/productivity', 'emoji/travel', 'bitbucket/repos'];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { type JSXAttribute, type Node } from 'eslint-codemod-utils';
|
|
3
|
+
import { type IconMigrationSizeGuidance } from '@atlaskit/icon/UNSAFE_migration-map';
|
|
3
4
|
export type iconMigrationError = Rule.ReportDescriptor;
|
|
4
5
|
export type errorsListManual = {
|
|
5
6
|
[loc: string]: {
|
|
@@ -23,6 +24,9 @@ export declare const isSize: (size: any) => size is "small" | "medium" | "large"
|
|
|
23
24
|
* @returns The migration map object for the legacy icon or null if not found
|
|
24
25
|
*/
|
|
25
26
|
export declare const getMigrationMapObject: (iconPackage: string) => any;
|
|
27
|
+
export declare const getUpcomingIcons: (iconPackage: string) => {
|
|
28
|
+
sizeGuidance: Record<Size, IconMigrationSizeGuidance>;
|
|
29
|
+
} | null;
|
|
26
30
|
/**
|
|
27
31
|
* Checks if a new icon can be auto-migrated based on guidance from the migration map
|
|
28
32
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const upcomingIcons: string[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { type JSXAttribute, type Node } from 'eslint-codemod-utils';
|
|
3
|
+
import { type IconMigrationSizeGuidance } from '@atlaskit/icon/UNSAFE_migration-map';
|
|
3
4
|
export type iconMigrationError = Rule.ReportDescriptor;
|
|
4
5
|
export type errorsListManual = {
|
|
5
6
|
[loc: string]: {
|
|
@@ -28,6 +29,9 @@ export declare const isSize: (size: any) => size is "small" | "medium" | "large"
|
|
|
28
29
|
* @returns The migration map object for the legacy icon or null if not found
|
|
29
30
|
*/
|
|
30
31
|
export declare const getMigrationMapObject: (iconPackage: string) => any;
|
|
32
|
+
export declare const getUpcomingIcons: (iconPackage: string) => {
|
|
33
|
+
sizeGuidance: Record<Size, IconMigrationSizeGuidance>;
|
|
34
|
+
} | null;
|
|
31
35
|
/**
|
|
32
36
|
* Checks if a new icon can be auto-migrated based on guidance from the migration map
|
|
33
37
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const upcomingIcons: string[];
|
package/package.json
CHANGED