@atlaskit/eslint-plugin-design-system 10.12.2 → 10.12.3
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 +9 -0
- package/dist/cjs/rules/no-legacy-icons/checks.js +3 -4
- package/dist/cjs/rules/no-legacy-icons/helpers.js +22 -17
- package/dist/es2019/rules/no-legacy-icons/checks.js +1 -2
- package/dist/es2019/rules/no-legacy-icons/helpers.js +13 -10
- package/dist/esm/rules/no-legacy-icons/checks.js +1 -2
- package/dist/esm/rules/no-legacy-icons/helpers.js +21 -16
- package/dist/types/rules/no-legacy-icons/helpers.d.ts +5 -14
- package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +10 -14
- package/package.json +2 -1
- package/dist/cjs/rules/no-legacy-icons/migration-map-temp.js +0 -4090
- package/dist/es2019/rules/no-legacy-icons/migration-map-temp.js +0 -4082
- package/dist/esm/rules/no-legacy-icons/migration-map-temp.js +0 -4084
- package/dist/types/rules/no-legacy-icons/migration-map-temp.d.ts +0 -22
- package/dist/types-ts4.5/rules/no-legacy-icons/migration-map-temp.d.ts +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 10.12.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#126553](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/126553)
|
|
8
|
+
[`a8d7e60d3b69d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a8d7e60d3b69d) -
|
|
9
|
+
Update `no-legacy-icons` rule to use icon migration map from `@atlaskit/icon`.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 10.12.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -8,7 +8,6 @@ exports.createChecks = void 0;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
10
10
|
var _helpers = require("./helpers");
|
|
11
|
-
var _migrationMapTemp = require("./migration-map-temp");
|
|
12
11
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
13
12
|
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); }
|
|
14
13
|
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; }
|
|
@@ -303,9 +302,9 @@ var createChecks = exports.createChecks = function createChecks(context) {
|
|
|
303
302
|
// Extract values of props
|
|
304
303
|
switch (attr.name.name) {
|
|
305
304
|
case 'size':
|
|
306
|
-
if ((0, _eslintCodemodUtils.isNodeOfType)(attr.value, 'Literal') && (0,
|
|
305
|
+
if ((0, _eslintCodemodUtils.isNodeOfType)(attr.value, 'Literal') && (0, _helpers.isSize)(attr.value.value)) {
|
|
307
306
|
size = attr.value.value;
|
|
308
|
-
} else if ((0, _eslintCodemodUtils.isNodeOfType)(attr.value, 'JSXExpressionContainer') && (0, _eslintCodemodUtils.isNodeOfType)(attr.value.expression, 'Literal') && (0,
|
|
307
|
+
} else if ((0, _eslintCodemodUtils.isNodeOfType)(attr.value, 'JSXExpressionContainer') && (0, _eslintCodemodUtils.isNodeOfType)(attr.value.expression, 'Literal') && (0, _helpers.isSize)(attr.value.expression.value)) {
|
|
309
308
|
size = attr.value.expression.value;
|
|
310
309
|
} else {
|
|
311
310
|
size = null;
|
|
@@ -357,7 +356,7 @@ var createChecks = exports.createChecks = function createChecks(context) {
|
|
|
357
356
|
} else if ((!newIcon || !isNewIconMigratable) && size) {
|
|
358
357
|
(0, _helpers.createCantFindSuitableReplacementError)(node, legacyIconImports[name].packageName, name, errorsManual, migrationMapObject ? true : false);
|
|
359
358
|
}
|
|
360
|
-
guidance[(0, _helpers.locToString)(node)] = (0, _helpers.createGuidance)(legacyIconImports[name].packageName, insideNewButton, size && (0,
|
|
359
|
+
guidance[(0, _helpers.locToString)(node)] = (0, _helpers.createGuidance)(legacyIconImports[name].packageName, insideNewButton, size && (0, _helpers.isSize)(size) ? size : undefined);
|
|
361
360
|
}
|
|
362
361
|
};
|
|
363
362
|
|
|
@@ -5,13 +5,18 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.locToString = 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.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
|
+
var _UNSAFE_migrationMap = _interopRequireWildcard(require("@atlaskit/icon/UNSAFE_migration-map"));
|
|
11
12
|
var _getImportName = require("../utils/get-import-name");
|
|
12
|
-
var _migrationMapTemp = _interopRequireWildcard(require("./migration-map-temp"));
|
|
13
13
|
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
14
|
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
|
+
var sizes = ['small', 'medium', 'large', 'xlarge'];
|
|
16
|
+
var isSize = exports.isSize = function isSize(size) {
|
|
17
|
+
return sizes.includes(size);
|
|
18
|
+
};
|
|
19
|
+
|
|
15
20
|
/**
|
|
16
21
|
* Returns the migration map object for a legacy icon or null if not found
|
|
17
22
|
* @param iconPackage The name of the legacy icon package
|
|
@@ -19,8 +24,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
19
24
|
*/
|
|
20
25
|
var getMigrationMapObject = exports.getMigrationMapObject = function getMigrationMapObject(iconPackage) {
|
|
21
26
|
var key = getIconKey(iconPackage);
|
|
22
|
-
if (key in
|
|
23
|
-
return
|
|
27
|
+
if (key in _UNSAFE_migrationMap.default) {
|
|
28
|
+
return _UNSAFE_migrationMap.default[key];
|
|
24
29
|
}
|
|
25
30
|
return null;
|
|
26
31
|
};
|
|
@@ -58,24 +63,24 @@ var createGuidance = exports.createGuidance = function createGuidance(iconPackag
|
|
|
58
63
|
var guidance = '';
|
|
59
64
|
if (size) {
|
|
60
65
|
if (migrationMapObject.sizeGuidance[size] && canAutoMigrateNewIconBasedOnSize(migrationMapObject.sizeGuidance[size])) {
|
|
61
|
-
guidance += "Fix: Use ".concat(newIcon.name, " from
|
|
66
|
+
guidance += "Fix: Use ".concat(newIcon.name, " from ").concat(newIcon.package, "/").concat(newIcon.type, "/").concat(newIcon.name, " instead.");
|
|
62
67
|
} else {
|
|
63
68
|
guidance += "No equivalent icon for this size, ".concat(size, ", in new set.");
|
|
64
69
|
}
|
|
65
|
-
guidance += "".concat(migrationMapObject.sizeGuidance[size] in
|
|
70
|
+
guidance += "".concat(migrationMapObject.sizeGuidance[size] in _UNSAFE_migrationMap.migrationOutcomeDescriptionMap ? " Please: ".concat(_UNSAFE_migrationMap.migrationOutcomeDescriptionMap[migrationMapObject.sizeGuidance[size]]) : ' No migration size advice given.', "\n");
|
|
66
71
|
} else {
|
|
67
|
-
guidance = "Use ".concat(newIcon.name, " from
|
|
68
|
-
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
value =
|
|
72
|
-
guidance += "\t- ".concat(
|
|
73
|
-
if (!(value in
|
|
72
|
+
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
|
+
Object.entries(migrationMapObject.sizeGuidance).forEach(function (_ref) {
|
|
74
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
75
|
+
size = _ref2[0],
|
|
76
|
+
value = _ref2[1];
|
|
77
|
+
guidance += "\t- ".concat(size, ": ");
|
|
78
|
+
if (!(value in _UNSAFE_migrationMap.migrationOutcomeDescriptionMap)) {
|
|
74
79
|
guidance += 'No migration advice given.\n';
|
|
75
80
|
} else {
|
|
76
|
-
guidance += "".concat(
|
|
81
|
+
guidance += "".concat(_UNSAFE_migrationMap.migrationOutcomeDescriptionMap[value], ".\n");
|
|
77
82
|
}
|
|
78
|
-
}
|
|
83
|
+
});
|
|
79
84
|
}
|
|
80
85
|
if (insideNewButton) {
|
|
81
86
|
guidance += buttonGuidanceStr;
|
|
@@ -254,9 +259,9 @@ var createHelpers = exports.createHelpers = function createHelpers(context) {
|
|
|
254
259
|
* Extracts the primaryColor value from a JSXAttribute
|
|
255
260
|
*/
|
|
256
261
|
getPrimaryColor: function getPrimaryColor(attr) {
|
|
257
|
-
var
|
|
262
|
+
var _ref3, _getLiteralStringValu;
|
|
258
263
|
var value = attr.value;
|
|
259
|
-
return (
|
|
264
|
+
return (_ref3 = (_getLiteralStringValu = getLiteralStringValue(value)) !== null && _getLiteralStringValu !== void 0 ? _getLiteralStringValu : getTokenCallValue(value)) !== null && _ref3 !== void 0 ? _ref3 : null;
|
|
260
265
|
},
|
|
261
266
|
getTokenCallValue: getTokenCallValue,
|
|
262
267
|
getConfigFlag: getConfigFlag
|
|
@@ -1,6 +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, locToString } from './helpers';
|
|
3
|
-
import { isSize } from './migration-map-temp';
|
|
2
|
+
import { canAutoMigrateNewIconBasedOnSize, canMigrateColor, createAutoMigrationError, createCantFindSuitableReplacementError, createCantMigrateColorError, createCantMigrateFunctionUnknownError, createCantMigrateIdentifierError, createCantMigrateReExportError, createCantMigrateSizeUnknown, createCantMigrateSpreadPropsError, createGuidance, createHelpers, getMigrationMapObject, isSize, locToString } from './helpers';
|
|
4
3
|
export const createChecks = context => {
|
|
5
4
|
//create global variables to be shared by the checks
|
|
6
5
|
const {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
+
import baseMigrationMap, { migrationOutcomeDescriptionMap } from '@atlaskit/icon/UNSAFE_migration-map';
|
|
2
3
|
import { getImportName } from '../utils/get-import-name';
|
|
3
|
-
|
|
4
|
+
const sizes = ['small', 'medium', 'large', 'xlarge'];
|
|
5
|
+
export const isSize = size => sizes.includes(size);
|
|
6
|
+
|
|
4
7
|
/**
|
|
5
8
|
* Returns the migration map object for a legacy icon or null if not found
|
|
6
9
|
* @param iconPackage The name of the legacy icon package
|
|
@@ -8,8 +11,8 @@ import migrationMap, { outcomeDescriptionMap } from './migration-map-temp';
|
|
|
8
11
|
*/
|
|
9
12
|
export const getMigrationMapObject = iconPackage => {
|
|
10
13
|
const key = getIconKey(iconPackage);
|
|
11
|
-
if (key in
|
|
12
|
-
return
|
|
14
|
+
if (key in baseMigrationMap) {
|
|
15
|
+
return baseMigrationMap[key];
|
|
13
16
|
}
|
|
14
17
|
return null;
|
|
15
18
|
};
|
|
@@ -45,21 +48,21 @@ export const createGuidance = (iconPackage, insideNewButton = false, size) => {
|
|
|
45
48
|
let guidance = '';
|
|
46
49
|
if (size) {
|
|
47
50
|
if (migrationMapObject.sizeGuidance[size] && canAutoMigrateNewIconBasedOnSize(migrationMapObject.sizeGuidance[size])) {
|
|
48
|
-
guidance += `Fix: Use ${newIcon.name} from
|
|
51
|
+
guidance += `Fix: Use ${newIcon.name} from ${newIcon.package}/${newIcon.type}/${newIcon.name} instead.`;
|
|
49
52
|
} else {
|
|
50
53
|
guidance += `No equivalent icon for this size, ${size}, in new set.`;
|
|
51
54
|
}
|
|
52
|
-
guidance += `${migrationMapObject.sizeGuidance[size] in
|
|
55
|
+
guidance += `${migrationMapObject.sizeGuidance[size] in migrationOutcomeDescriptionMap ? ` Please: ${migrationOutcomeDescriptionMap[migrationMapObject.sizeGuidance[size]]}` : ' No migration size advice given.'}\n`;
|
|
53
56
|
} else {
|
|
54
|
-
guidance = `Use ${newIcon.name} from
|
|
55
|
-
|
|
57
|
+
guidance = `Use ${newIcon.name} from ${newIcon.package}/${newIcon.type}/${newIcon.name} instead.\nMigration suggestions, depending on the legacy icon size:\n`;
|
|
58
|
+
Object.entries(migrationMapObject.sizeGuidance).forEach(([size, value]) => {
|
|
56
59
|
guidance += `\t- ${size}: `;
|
|
57
|
-
if (!(value in
|
|
60
|
+
if (!(value in migrationOutcomeDescriptionMap)) {
|
|
58
61
|
guidance += 'No migration advice given.\n';
|
|
59
62
|
} else {
|
|
60
|
-
guidance += `${
|
|
63
|
+
guidance += `${migrationOutcomeDescriptionMap[value]}.\n`;
|
|
61
64
|
}
|
|
62
|
-
}
|
|
65
|
+
});
|
|
63
66
|
}
|
|
64
67
|
if (insideNewButton) {
|
|
65
68
|
guidance += buttonGuidanceStr;
|
|
@@ -3,8 +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, locToString } from './helpers';
|
|
7
|
-
import { isSize } from './migration-map-temp';
|
|
6
|
+
import { canAutoMigrateNewIconBasedOnSize, canMigrateColor, createAutoMigrationError, createCantFindSuitableReplacementError, createCantMigrateColorError, createCantMigrateFunctionUnknownError, createCantMigrateIdentifierError, createCantMigrateReExportError, createCantMigrateSizeUnknown, createCantMigrateSpreadPropsError, createGuidance, createHelpers, getMigrationMapObject, isSize, locToString } from './helpers';
|
|
8
7
|
export var createChecks = function createChecks(context) {
|
|
9
8
|
//create global variables to be shared by the checks
|
|
10
9
|
var _createHelpers = createHelpers(context),
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
3
|
+
import baseMigrationMap, { migrationOutcomeDescriptionMap } from '@atlaskit/icon/UNSAFE_migration-map';
|
|
3
4
|
import { getImportName } from '../utils/get-import-name';
|
|
4
|
-
|
|
5
|
+
var sizes = ['small', 'medium', 'large', 'xlarge'];
|
|
6
|
+
export var isSize = function isSize(size) {
|
|
7
|
+
return sizes.includes(size);
|
|
8
|
+
};
|
|
9
|
+
|
|
5
10
|
/**
|
|
6
11
|
* Returns the migration map object for a legacy icon or null if not found
|
|
7
12
|
* @param iconPackage The name of the legacy icon package
|
|
@@ -9,8 +14,8 @@ import migrationMap, { outcomeDescriptionMap } from './migration-map-temp';
|
|
|
9
14
|
*/
|
|
10
15
|
export var getMigrationMapObject = function getMigrationMapObject(iconPackage) {
|
|
11
16
|
var key = getIconKey(iconPackage);
|
|
12
|
-
if (key in
|
|
13
|
-
return
|
|
17
|
+
if (key in baseMigrationMap) {
|
|
18
|
+
return baseMigrationMap[key];
|
|
14
19
|
}
|
|
15
20
|
return null;
|
|
16
21
|
};
|
|
@@ -48,24 +53,24 @@ export var createGuidance = function createGuidance(iconPackage) {
|
|
|
48
53
|
var guidance = '';
|
|
49
54
|
if (size) {
|
|
50
55
|
if (migrationMapObject.sizeGuidance[size] && canAutoMigrateNewIconBasedOnSize(migrationMapObject.sizeGuidance[size])) {
|
|
51
|
-
guidance += "Fix: Use ".concat(newIcon.name, " from
|
|
56
|
+
guidance += "Fix: Use ".concat(newIcon.name, " from ").concat(newIcon.package, "/").concat(newIcon.type, "/").concat(newIcon.name, " instead.");
|
|
52
57
|
} else {
|
|
53
58
|
guidance += "No equivalent icon for this size, ".concat(size, ", in new set.");
|
|
54
59
|
}
|
|
55
|
-
guidance += "".concat(migrationMapObject.sizeGuidance[size] in
|
|
60
|
+
guidance += "".concat(migrationMapObject.sizeGuidance[size] in migrationOutcomeDescriptionMap ? " Please: ".concat(migrationOutcomeDescriptionMap[migrationMapObject.sizeGuidance[size]]) : ' No migration size advice given.', "\n");
|
|
56
61
|
} else {
|
|
57
|
-
guidance = "Use ".concat(newIcon.name, " from
|
|
58
|
-
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
value =
|
|
62
|
-
guidance += "\t- ".concat(
|
|
63
|
-
if (!(value in
|
|
62
|
+
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
|
+
Object.entries(migrationMapObject.sizeGuidance).forEach(function (_ref) {
|
|
64
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
65
|
+
size = _ref2[0],
|
|
66
|
+
value = _ref2[1];
|
|
67
|
+
guidance += "\t- ".concat(size, ": ");
|
|
68
|
+
if (!(value in migrationOutcomeDescriptionMap)) {
|
|
64
69
|
guidance += 'No migration advice given.\n';
|
|
65
70
|
} else {
|
|
66
|
-
guidance += "".concat(
|
|
71
|
+
guidance += "".concat(migrationOutcomeDescriptionMap[value], ".\n");
|
|
67
72
|
}
|
|
68
|
-
}
|
|
73
|
+
});
|
|
69
74
|
}
|
|
70
75
|
if (insideNewButton) {
|
|
71
76
|
guidance += buttonGuidanceStr;
|
|
@@ -244,9 +249,9 @@ export var createHelpers = function createHelpers(context) {
|
|
|
244
249
|
* Extracts the primaryColor value from a JSXAttribute
|
|
245
250
|
*/
|
|
246
251
|
getPrimaryColor: function getPrimaryColor(attr) {
|
|
247
|
-
var
|
|
252
|
+
var _ref3, _getLiteralStringValu;
|
|
248
253
|
var value = attr.value;
|
|
249
|
-
return (
|
|
254
|
+
return (_ref3 = (_getLiteralStringValu = getLiteralStringValue(value)) !== null && _getLiteralStringValu !== void 0 ? _getLiteralStringValu : getTokenCallValue(value)) !== null && _ref3 !== void 0 ? _ref3 : null;
|
|
250
255
|
},
|
|
251
256
|
getTokenCallValue: getTokenCallValue,
|
|
252
257
|
getConfigFlag: getConfigFlag
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { type JSXAttribute, type Node } from 'eslint-codemod-utils';
|
|
3
|
-
import { type Size } from './migration-map-temp';
|
|
4
3
|
export type iconMigrationError = Rule.ReportDescriptor;
|
|
5
4
|
export type errorsListManual = {
|
|
6
5
|
[loc: string]: {
|
|
@@ -15,24 +14,15 @@ export type errorsListAuto = {
|
|
|
15
14
|
export type guidanceList = {
|
|
16
15
|
[loc: string]: string;
|
|
17
16
|
};
|
|
17
|
+
declare const sizes: readonly ["small", "medium", "large", "xlarge"];
|
|
18
|
+
export type Size = (typeof sizes)[number];
|
|
19
|
+
export declare const isSize: (size: any) => size is "small" | "medium" | "large" | "xlarge";
|
|
18
20
|
/**
|
|
19
21
|
* Returns the migration map object for a legacy icon or null if not found
|
|
20
22
|
* @param iconPackage The name of the legacy icon package
|
|
21
23
|
* @returns The migration map object for the legacy icon or null if not found
|
|
22
24
|
*/
|
|
23
|
-
export declare const getMigrationMapObject: (iconPackage: string) =>
|
|
24
|
-
sizeGuidance: {
|
|
25
|
-
small: string;
|
|
26
|
-
medium: string;
|
|
27
|
-
large: string;
|
|
28
|
-
xlarge: string;
|
|
29
|
-
};
|
|
30
|
-
newIcon?: {
|
|
31
|
-
name: string;
|
|
32
|
-
type: string;
|
|
33
|
-
library: string;
|
|
34
|
-
} | undefined;
|
|
35
|
-
} | null;
|
|
25
|
+
export declare const getMigrationMapObject: (iconPackage: string) => any;
|
|
36
26
|
/**
|
|
37
27
|
* Checks if a new icon can be auto-migrated based on guidance from the migration map
|
|
38
28
|
*/
|
|
@@ -65,3 +55,4 @@ export declare const createHelpers: (context: Rule.RuleContext) => {
|
|
|
65
55
|
getTokenCallValue: (value: any) => string | undefined;
|
|
66
56
|
getConfigFlag: (key: string, defaultValue: boolean) => boolean;
|
|
67
57
|
};
|
|
58
|
+
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { type JSXAttribute, type Node } from 'eslint-codemod-utils';
|
|
3
|
-
import { type Size } from './migration-map-temp';
|
|
4
3
|
export type iconMigrationError = Rule.ReportDescriptor;
|
|
5
4
|
export type errorsListManual = {
|
|
6
5
|
[loc: string]: {
|
|
@@ -15,24 +14,20 @@ export type errorsListAuto = {
|
|
|
15
14
|
export type guidanceList = {
|
|
16
15
|
[loc: string]: string;
|
|
17
16
|
};
|
|
17
|
+
declare const sizes: readonly [
|
|
18
|
+
"small",
|
|
19
|
+
"medium",
|
|
20
|
+
"large",
|
|
21
|
+
"xlarge"
|
|
22
|
+
];
|
|
23
|
+
export type Size = (typeof sizes)[number];
|
|
24
|
+
export declare const isSize: (size: any) => size is "small" | "medium" | "large" | "xlarge";
|
|
18
25
|
/**
|
|
19
26
|
* Returns the migration map object for a legacy icon or null if not found
|
|
20
27
|
* @param iconPackage The name of the legacy icon package
|
|
21
28
|
* @returns The migration map object for the legacy icon or null if not found
|
|
22
29
|
*/
|
|
23
|
-
export declare const getMigrationMapObject: (iconPackage: string) =>
|
|
24
|
-
sizeGuidance: {
|
|
25
|
-
small: string;
|
|
26
|
-
medium: string;
|
|
27
|
-
large: string;
|
|
28
|
-
xlarge: string;
|
|
29
|
-
};
|
|
30
|
-
newIcon?: {
|
|
31
|
-
name: string;
|
|
32
|
-
type: string;
|
|
33
|
-
library: string;
|
|
34
|
-
} | undefined;
|
|
35
|
-
} | null;
|
|
30
|
+
export declare const getMigrationMapObject: (iconPackage: string) => any;
|
|
36
31
|
/**
|
|
37
32
|
* Checks if a new icon can be auto-migrated based on guidance from the migration map
|
|
38
33
|
*/
|
|
@@ -65,3 +60,4 @@ export declare const createHelpers: (context: Rule.RuleContext) => {
|
|
|
65
60
|
getTokenCallValue: (value: any) => string | undefined;
|
|
66
61
|
getConfigFlag: (key: string, defaultValue: boolean) => boolean;
|
|
67
62
|
};
|
|
63
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/eslint-plugin-design-system",
|
|
3
3
|
"description": "The essential plugin for use with the Atlassian Design System.",
|
|
4
|
-
"version": "10.12.
|
|
4
|
+
"version": "10.12.3",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"publishConfig": {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@atlaskit/eslint-utils": "^1.6.0",
|
|
45
|
+
"@atlaskit/icon": "^22.10.0",
|
|
45
46
|
"@atlaskit/tokens": "*",
|
|
46
47
|
"@babel/runtime": "^7.0.0",
|
|
47
48
|
"@typescript-eslint/utils": "^5.48.1",
|