@atlaskit/eslint-plugin-design-system 10.10.0 → 10.10.2
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 +19 -0
- package/dist/cjs/rules/no-legacy-icons/checks.js +63 -67
- package/dist/cjs/rules/no-legacy-icons/helpers.js +29 -24
- package/dist/cjs/rules/no-legacy-icons/index.js +4 -5
- package/dist/cjs/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +3 -2
- package/dist/cjs/rules/use-tokens-space/transformers/style-property/supported.js +3 -2
- package/dist/cjs/rules/use-visually-hidden/fix-jsx.js +4 -2
- package/dist/cjs/rules/use-visually-hidden/fix-vanilla.js +4 -2
- package/dist/es2019/rules/no-legacy-icons/checks.js +20 -33
- package/dist/es2019/rules/no-legacy-icons/helpers.js +24 -21
- package/dist/es2019/rules/no-legacy-icons/index.js +4 -5
- package/dist/es2019/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +3 -2
- package/dist/es2019/rules/use-tokens-space/transformers/style-property/supported.js +3 -2
- package/dist/es2019/rules/use-visually-hidden/fix-jsx.js +3 -2
- package/dist/es2019/rules/use-visually-hidden/fix-vanilla.js +3 -2
- package/dist/esm/rules/no-legacy-icons/checks.js +64 -68
- package/dist/esm/rules/no-legacy-icons/helpers.js +28 -23
- package/dist/esm/rules/no-legacy-icons/index.js +4 -5
- package/dist/esm/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +3 -2
- package/dist/esm/rules/use-tokens-space/transformers/style-property/supported.js +3 -2
- package/dist/esm/rules/use-visually-hidden/fix-jsx.js +3 -2
- package/dist/esm/rules/use-visually-hidden/fix-vanilla.js +3 -2
- package/dist/types/rules/no-legacy-icons/helpers.d.ts +3 -13
- package/dist/types/rules/use-latest-xcss-syntax/transformers/style-property/supported.d.ts +2 -2
- package/dist/types/rules/use-tokens-space/transformers/style-property/supported.d.ts +2 -2
- package/dist/types/rules/use-visually-hidden/fix-jsx.d.ts +2 -2
- package/dist/types/rules/use-visually-hidden/fix-vanilla.d.ts +2 -2
- package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +3 -13
- package/dist/types-ts4.5/rules/use-latest-xcss-syntax/transformers/style-property/supported.d.ts +2 -2
- package/dist/types-ts4.5/rules/use-tokens-space/transformers/style-property/supported.d.ts +2 -2
- package/dist/types-ts4.5/rules/use-visually-hidden/fix-jsx.d.ts +2 -2
- package/dist/types-ts4.5/rules/use-visually-hidden/fix-vanilla.d.ts +2 -2
- package/package.json +2 -2
- package/constellation/consistent-css-prop-usage/usage.mdx +0 -210
- package/constellation/ensure-design-token-usage/usage.mdx +0 -77
- package/constellation/ensure-design-token-usage-preview/usage.mdx +0 -6
- package/constellation/icon-label/usage.mdx +0 -41
- package/constellation/index/props.mdx +0 -30
- package/constellation/index/usage.mdx +0 -57
- package/constellation/no-banned-imports/usage.mdx +0 -19
- package/constellation/no-css-tagged-template-expression/usage.mdx +0 -71
- package/constellation/no-custom-icons/usage.mdx +0 -36
- package/constellation/no-deprecated-apis/usage.mdx +0 -82
- package/constellation/no-deprecated-design-token-usage/usage.mdx +0 -30
- package/constellation/no-deprecated-imports/usage.mdx +0 -66
- package/constellation/no-direct-use-of-web-platform-drag-and-drop/usage.mdx +0 -149
- package/constellation/no-empty-styled-expression/usage.mdx +0 -82
- package/constellation/no-exported-css/usage.mdx +0 -55
- package/constellation/no-exported-keyframes/usage.mdx +0 -55
- package/constellation/no-html-anchor/usage.mdx +0 -46
- package/constellation/no-html-button/usage.mdx +0 -52
- package/constellation/no-invalid-css-map/usage.mdx +0 -210
- package/constellation/no-keyframes-tagged-template-expression/usage.mdx +0 -80
- package/constellation/no-legacy-icons/usage.mdx +0 -42
- package/constellation/no-margin/usage.mdx +0 -21
- package/constellation/no-nested-styles/usage.mdx +0 -47
- package/constellation/no-physical-properties/usage.mdx +0 -53
- package/constellation/no-styled-tagged-template-expression/usage.mdx +0 -135
- package/constellation/no-unsafe-design-token-usage/usage.mdx +0 -50
- package/constellation/no-unsafe-style-overrides/usage.mdx +0 -52
- package/constellation/no-unsupported-drag-and-drop-libraries/usage.mdx +0 -23
- package/constellation/prefer-primitives/usage.mdx +0 -32
- package/constellation/use-button-group-label/usage.mdx +0 -60
- package/constellation/use-drawer-label/usage.mdx +0 -55
- package/constellation/use-heading/usage.mdx +0 -31
- package/constellation/use-heading-level-in-spotlight-card/usage.mdx +0 -21
- package/constellation/use-href-in-link-item/usage.mdx +0 -19
- package/constellation/use-latest-xcss-syntax/usage.mdx +0 -33
- package/constellation/use-latest-xcss-syntax-typography/usage.mdx +0 -34
- package/constellation/use-menu-section-title/usage.mdx +0 -55
- package/constellation/use-popup-label/usage.mdx +0 -56
- package/constellation/use-primitives/usage.mdx +0 -78
- package/constellation/use-primitives-text/usage.mdx +0 -35
- package/constellation/use-tokens-space/usage.mdx +0 -34
- package/constellation/use-tokens-typography/usage.mdx +0 -55
- package/constellation/use-visually-hidden/usage.mdx +0 -35
|
@@ -19,7 +19,7 @@ export const getMigrationMapObject = iconPackage => {
|
|
|
19
19
|
* @param iconPackage The name of the legacy icon package
|
|
20
20
|
* @returns The unique identifier for the icon (the part after "@atlaskit/icon/glyph")
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
const getIconKey = iconPackage => {
|
|
23
23
|
const key = iconPackage.replace(/^@atlaskit\/icon\/glyph\//, '');
|
|
24
24
|
return key;
|
|
25
25
|
};
|
|
@@ -34,36 +34,43 @@ export const canAutoMigrateNewIconBasedOnSize = guidance => {
|
|
|
34
34
|
/**
|
|
35
35
|
* Creates the written guidance for migrating a legacy icon to a new icon
|
|
36
36
|
*/
|
|
37
|
-
export const createGuidance = (iconPackage, size) => {
|
|
37
|
+
export const createGuidance = (iconPackage, insideNewButton = false, size) => {
|
|
38
38
|
const migrationMapObject = getMigrationMapObject(iconPackage);
|
|
39
39
|
if (migrationMapObject) {
|
|
40
40
|
const newIcon = migrationMapObject.newIcon;
|
|
41
41
|
if (!newIcon) {
|
|
42
42
|
return 'No equivalent icon in new set. An option is to contribute a custom icon into icon-labs package instead.\n';
|
|
43
43
|
}
|
|
44
|
+
const buttonGuidanceStr = "Please set 'spacing' property of the new icon to 'none', to ensure appropriate spacing inside `@atlaskit/button`.\n";
|
|
45
|
+
let guidance = '';
|
|
44
46
|
if (size) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
guidance += ` Please: ${outcomeDescriptionMap[migrationMapObject.sizeGuidance[size]]}\n`;
|
|
47
|
+
if (migrationMapObject.sizeGuidance[size] && canAutoMigrateNewIconBasedOnSize(migrationMapObject.sizeGuidance[size])) {
|
|
48
|
+
guidance += `Fix: Use ${newIcon.name} from @atlaskit/${newIcon.library}/${newIcon.type}/${newIcon.name} instead.`;
|
|
48
49
|
} else {
|
|
49
|
-
guidance +=
|
|
50
|
+
guidance += `No equivalent icon for this size, ${size}, in new set.`;
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
+
guidance += `${migrationMapObject.sizeGuidance[size] in outcomeDescriptionMap ? ` Please: ${outcomeDescriptionMap[migrationMapObject.sizeGuidance[size]]}` : ' No migration size advice given.'}\n`;
|
|
52
53
|
} else {
|
|
53
|
-
|
|
54
|
+
guidance = `Use ${newIcon.name} from @atlaskit/${newIcon.library}/${newIcon.type}/${newIcon.name} instead.\nMigration suggestions, depending on the legacy icon size:\n`;
|
|
54
55
|
for (const [size, value] of Object.entries(migrationMapObject.sizeGuidance)) {
|
|
55
56
|
guidance += `\t- ${size}: `;
|
|
56
57
|
if (!(value in outcomeDescriptionMap)) {
|
|
57
58
|
guidance += 'No migration advice given.\n';
|
|
58
59
|
} else {
|
|
59
|
-
guidance += `${outcomeDescriptionMap[value]}
|
|
60
|
+
guidance += `${outcomeDescriptionMap[value]}.\n`;
|
|
60
61
|
}
|
|
61
|
-
guidance;
|
|
62
62
|
}
|
|
63
|
-
return guidance;
|
|
64
63
|
}
|
|
64
|
+
if (insideNewButton) {
|
|
65
|
+
guidance += buttonGuidanceStr;
|
|
66
|
+
} else if (size && size === 'medium') {
|
|
67
|
+
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";
|
|
68
|
+
} else if (size) {
|
|
69
|
+
guidance += "In the new icon, please use spacing='none'.\n";
|
|
70
|
+
}
|
|
71
|
+
return guidance;
|
|
65
72
|
} else {
|
|
66
|
-
return
|
|
73
|
+
return `Migration suggestions not found for "${iconPackage}".\n`;
|
|
67
74
|
}
|
|
68
75
|
};
|
|
69
76
|
|
|
@@ -139,13 +146,14 @@ export const createCantMigrateUnsafeProp = (node, propName, value, packageName,
|
|
|
139
146
|
};
|
|
140
147
|
pushManualError(locToString(node), errors, myError, packageName, iconName);
|
|
141
148
|
};
|
|
142
|
-
export const createCantFindSuitableReplacementError = (node, importSource, iconName, errors) => {
|
|
149
|
+
export const createCantFindSuitableReplacementError = (node, importSource, iconName, errors, sizeIssue) => {
|
|
143
150
|
const myError = {
|
|
144
151
|
node,
|
|
145
152
|
messageId: 'cantFindSuitableReplacement',
|
|
146
153
|
data: {
|
|
147
154
|
importSource,
|
|
148
|
-
iconName
|
|
155
|
+
iconName,
|
|
156
|
+
sizeGuidance: sizeIssue ? ' at the current size' : ''
|
|
149
157
|
}
|
|
150
158
|
};
|
|
151
159
|
pushManualError(locToString(node), errors, myError, importSource, iconName);
|
|
@@ -188,18 +196,13 @@ export const createCantMigrateSizeUnknown = (node, errors, importSource, iconNam
|
|
|
188
196
|
};
|
|
189
197
|
pushManualError(locToString(node), errors, myError, importSource, iconName);
|
|
190
198
|
};
|
|
191
|
-
export const createAutoMigrationError = (node, importSource, iconName,
|
|
192
|
-
const migrationKey = newIcon.name === oldIconName ? newIcon.name : `${newIcon.name}--${oldIconName}`;
|
|
193
|
-
const newMigrationIconPackage = `@atlaskit/${newIcon.library}/${newIcon.type}/migration/${migrationKey}`;
|
|
199
|
+
export const createAutoMigrationError = (node, importSource, iconName, errors) => {
|
|
194
200
|
const myError = {
|
|
195
201
|
node,
|
|
196
202
|
messageId: 'noLegacyIconsAutoMigration',
|
|
197
203
|
data: {
|
|
198
204
|
importSource,
|
|
199
|
-
iconName
|
|
200
|
-
newIcon: newIcon.name,
|
|
201
|
-
//TODO: provide size guidance
|
|
202
|
-
newPackage: newMigrationIconPackage
|
|
205
|
+
iconName
|
|
203
206
|
}
|
|
204
207
|
};
|
|
205
208
|
errors[locToString(node)] = myError;
|
|
@@ -27,17 +27,16 @@ const rule = createLintRule({
|
|
|
27
27
|
additionalProperties: false
|
|
28
28
|
}],
|
|
29
29
|
messages: {
|
|
30
|
-
noLegacyIconsAutoMigration: `Auto Migration:\nLegacy icon '{{iconName}}' from '{{importSource}}' detected.\nAutomatic migration is possible
|
|
31
|
-
noLegacyIconsManualMigration: `Manual Migration:\nLegacy icon '{{iconName}}' from '{{importSource}}' detected.\nAutomatic migration not possible
|
|
32
|
-
cantFindSuitableReplacement: `No suitable replacement found for '{{iconName}}' from '{{importSource}}'
|
|
30
|
+
noLegacyIconsAutoMigration: `Auto Migration:\nLegacy icon '{{iconName}}' from '{{importSource}}' detected.\nAutomatic migration is possible.\n\n{{guidance}}\nAtlassians: See https://go.atlassian.com/icon-migration-guide for details.'`,
|
|
31
|
+
noLegacyIconsManualMigration: `Manual Migration:\nLegacy icon '{{iconName}}' from '{{importSource}}' detected.\nAutomatic migration not possible.\n\n{{guidance}}\nAtlassians: See https://go.atlassian.com/icon-migration-guide for details.`,
|
|
32
|
+
cantFindSuitableReplacement: `No suitable replacement found for '{{iconName}}' from '{{importSource}}'{{sizeGuidance}}. Please manually migrate this icon.`,
|
|
33
33
|
cantMigrateReExport: `'{{exportName}}' is a re-export of icon from '{{packageName}}' and cannot be automatically migrated. Please utilize the export from icons directly.`,
|
|
34
34
|
cantMigrateColor: `Primary Color prop has {{colorValue}} which cannot be automatically migrated to color prop in the new Icon API. Please use either an appropriate color.icon, color.link token, or currentColor (as a last resort).`,
|
|
35
35
|
cantMigrateSpreadProps: `This usage of Icon uses spread props in a way that can't be automatically migrated. Please explicitly define the following props after spread: '{{missingProps}}' `,
|
|
36
36
|
cantMigrateSizeUnknown: `This usage of Icon sets the size via a variable or function that can't be determined.`,
|
|
37
37
|
cantMigrateFunctionUnknown: `'{{iconName}}' from legacy '{{importSource}}' is used in unknown function/component. Please manually migrate this icon.`,
|
|
38
38
|
cantMigrateIdentifier: `This icon is passed to other components via a map or array, in a way that can't be automatically migrated. Please manually migrate wherever this expression is used and use the icon components directly.`,
|
|
39
|
-
cantMigrateUnsafeProp: `Property '{{propName}}' with value of '{{value}}' is unable to be auto-migrated to the new button. Please manually migrate this icon
|
|
40
|
-
guidance: `Guidance:\n'{{guidance}}'`
|
|
39
|
+
cantMigrateUnsafeProp: `Property '{{propName}}' with value of '{{value}}' is unable to be auto-migrated to the new button. Please manually migrate this icon.`
|
|
41
40
|
}
|
|
42
41
|
},
|
|
43
42
|
create(context) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
const supported = {
|
|
2
2
|
values: {
|
|
3
3
|
ignore: ['auto', 'initial', 'inherit', 'unset', 'revert', 'revert-layer',
|
|
4
4
|
// Currently the DST opinion is that 0 is valid. It doesn't need to be converted to `space.0`
|
|
5
5
|
'0', '0 auto', 'space.negative.025', 'space.negative.050', 'space.negative.075', 'space.negative.100', 'space.negative.150', 'space.negative.200', 'space.negative.250', 'space.negative.300', 'space.negative.400', 'space.0', 'space.025', 'space.050', 'space.075', 'space.100', 'space.150', 'space.200', 'space.250', 'space.300', 'space.400', 'space.500', 'space.600', 'space.800', 'space.1000']
|
|
6
6
|
}
|
|
7
|
-
};
|
|
7
|
+
};
|
|
8
|
+
export default supported;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
const supported = {
|
|
2
2
|
values: {
|
|
3
3
|
ignore: ['auto', 'initial', 'inherit', 'unset', 'revert', 'revert-layer', 'none',
|
|
4
4
|
// outline-offset can be set to none
|
|
5
5
|
// Currently the DST opinion is that 0 is valid. It doesn't need to be converted to `space.0`
|
|
6
6
|
0, '0', '0px', '0em', '0rem']
|
|
7
7
|
}
|
|
8
|
-
};
|
|
8
|
+
};
|
|
9
|
+
export default supported;
|
|
@@ -4,7 +4,7 @@ import { closestOfType } from 'eslint-codemod-utils';
|
|
|
4
4
|
import { getImportedNodeBySource } from '../utils/get-import-node-by-source';
|
|
5
5
|
import { IMPORT_NAME, VISUALLY_HIDDEN_IMPORT, VISUALLY_HIDDEN_SOURCE } from './constants';
|
|
6
6
|
import { getFirstImport } from './utils';
|
|
7
|
-
|
|
7
|
+
const fixJsx = (source, node) => fixer => {
|
|
8
8
|
const fixes = [];
|
|
9
9
|
const importedNode = getFirstImport(source);
|
|
10
10
|
const visuallyHiddenNode = getImportedNodeBySource(source, VISUALLY_HIDDEN_SOURCE);
|
|
@@ -19,4 +19,5 @@ export default ((source, node) => fixer => {
|
|
|
19
19
|
fixes.push(fixer.replaceText(jsxOpeningElement, `<${IMPORT_NAME} />`));
|
|
20
20
|
}
|
|
21
21
|
return fixes;
|
|
22
|
-
}
|
|
22
|
+
};
|
|
23
|
+
export default fixJsx;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { getImportedNodeBySource } from '../utils/get-import-node-by-source';
|
|
4
4
|
import { IMPORT_NAME, VISUALLY_HIDDEN_IMPORT, VISUALLY_HIDDEN_SOURCE } from './constants';
|
|
5
5
|
import { getFirstImport } from './utils';
|
|
6
|
-
|
|
6
|
+
const fixVanilla = (source, node) => fixer => {
|
|
7
7
|
const fixes = [];
|
|
8
8
|
const importedNode = getFirstImport(source);
|
|
9
9
|
const visuallyHiddenNode = getImportedNodeBySource(source, VISUALLY_HIDDEN_SOURCE);
|
|
@@ -17,4 +17,5 @@ export default ((source, node) => fixer => {
|
|
|
17
17
|
fixes.push(fixer.replaceText(node, IMPORT_NAME));
|
|
18
18
|
}
|
|
19
19
|
return fixes;
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
|
+
export default fixVanilla;
|
|
@@ -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, createCantMigrateUnsafeProp, createGuidance, createHelpers, findUNSAFEProp,
|
|
6
|
+
import { canAutoMigrateNewIconBasedOnSize, canMigrateColor, createAutoMigrationError, createCantFindSuitableReplacementError, createCantMigrateColorError, createCantMigrateFunctionUnknownError, createCantMigrateIdentifierError, createCantMigrateReExportError, createCantMigrateSizeUnknown, createCantMigrateSpreadPropsError, createCantMigrateUnsafeProp, createGuidance, createHelpers, findUNSAFEProp, getMigrationMapObject, locToString } from './helpers';
|
|
7
7
|
import { isSize } from './migration-map-temp';
|
|
8
8
|
export var createChecks = function createChecks(context) {
|
|
9
9
|
//create global variables to be shared by the checks
|
|
@@ -134,25 +134,36 @@ export var createChecks = function createChecks(context) {
|
|
|
134
134
|
if (typeof moduleSource === 'string' && ['@atlaskit/icon/glyph/', '@atlaskit/icon-object/glyph/'].find(function (val) {
|
|
135
135
|
return moduleSource.startsWith(val);
|
|
136
136
|
}) && node.specifiers.length) {
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
var _iterator4 = _createForOfIteratorHelper(node.specifiers),
|
|
138
|
+
_step4;
|
|
139
|
+
try {
|
|
140
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
141
|
+
var spec = _step4.value;
|
|
142
|
+
createCantMigrateReExportError(spec, moduleSource, spec.exported.name, errorsManual);
|
|
143
|
+
guidance[locToString(spec)] = createGuidance(moduleSource);
|
|
144
|
+
}
|
|
145
|
+
} catch (err) {
|
|
146
|
+
_iterator4.e(err);
|
|
147
|
+
} finally {
|
|
148
|
+
_iterator4.f();
|
|
149
|
+
}
|
|
139
150
|
}
|
|
140
151
|
} else if (node.declaration && isNodeOfType(node.declaration, 'VariableDeclaration')) {
|
|
141
152
|
// export const Icon = AddIcon;
|
|
142
|
-
var
|
|
143
|
-
|
|
153
|
+
var _iterator5 = _createForOfIteratorHelper(node.declaration.declarations),
|
|
154
|
+
_step5;
|
|
144
155
|
try {
|
|
145
|
-
for (
|
|
146
|
-
var decl =
|
|
156
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
157
|
+
var decl = _step5.value;
|
|
147
158
|
if (isNodeOfType(decl, 'VariableDeclarator') && 'init' in decl && decl.init && isNodeOfType(decl.init, 'Identifier') && decl.init.name in legacyIconImports) {
|
|
148
159
|
createCantMigrateReExportError(node, legacyIconImports[decl.init.name].packageName, decl.init.name, errorsManual);
|
|
149
|
-
guidance[locToString(node)] = createGuidance(
|
|
160
|
+
guidance[locToString(node)] = createGuidance(legacyIconImports[decl.init.name].packageName);
|
|
150
161
|
}
|
|
151
162
|
}
|
|
152
163
|
} catch (err) {
|
|
153
|
-
|
|
164
|
+
_iterator5.e(err);
|
|
154
165
|
} finally {
|
|
155
|
-
|
|
166
|
+
_iterator5.f();
|
|
156
167
|
}
|
|
157
168
|
} else if (!node.source && node.specifiers && node.specifiers.length > 0) {
|
|
158
169
|
/**
|
|
@@ -161,25 +172,25 @@ export var createChecks = function createChecks(context) {
|
|
|
161
172
|
* const crossIcon = LegacyIcon2;
|
|
162
173
|
* export { AddIcon, CrossIcon as default }
|
|
163
174
|
*/
|
|
164
|
-
var
|
|
165
|
-
|
|
175
|
+
var _iterator6 = _createForOfIteratorHelper(node.specifiers),
|
|
176
|
+
_step6;
|
|
166
177
|
try {
|
|
167
|
-
for (
|
|
168
|
-
var
|
|
169
|
-
if (
|
|
178
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
179
|
+
var _spec2 = _step6.value;
|
|
180
|
+
if (_spec2.local.name in legacyIconImports) {
|
|
170
181
|
//update legacy imports to be exported
|
|
171
|
-
legacyIconImports[
|
|
172
|
-
packageName: legacyIconImports[
|
|
182
|
+
legacyIconImports[_spec2.local.name] = {
|
|
183
|
+
packageName: legacyIconImports[_spec2.local.name].packageName,
|
|
173
184
|
exported: true
|
|
174
185
|
};
|
|
175
|
-
createCantMigrateReExportError(
|
|
176
|
-
guidance[locToString(
|
|
186
|
+
createCantMigrateReExportError(_spec2, legacyIconImports[_spec2.local.name].packageName, _spec2.exported.name, errorsManual);
|
|
187
|
+
guidance[locToString(_spec2)] = createGuidance(legacyIconImports[_spec2.local.name].packageName);
|
|
177
188
|
}
|
|
178
189
|
}
|
|
179
190
|
} catch (err) {
|
|
180
|
-
|
|
191
|
+
_iterator6.e(err);
|
|
181
192
|
} finally {
|
|
182
|
-
|
|
193
|
+
_iterator6.f();
|
|
183
194
|
}
|
|
184
195
|
}
|
|
185
196
|
};
|
|
@@ -226,18 +237,17 @@ export var createChecks = function createChecks(context) {
|
|
|
226
237
|
UNSAFE_propName = result.UNSAFE_propName;
|
|
227
238
|
}
|
|
228
239
|
if (newIcon && isInNewButton && isNewIconMigratable && UNSAFE_size !== 'large' && UNSAFE_size !== 'xlarge') {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
guidance[locToString(node)] = createGuidance(legacyIconImports[node.name].packageName, 'medium');
|
|
240
|
+
createAutoMigrationError(node, legacyIconImports[node.name].packageName, node.name, errorsAuto);
|
|
241
|
+
guidance[locToString(node)] = createGuidance(legacyIconImports[node.name].packageName, isInNewButton, 'medium');
|
|
232
242
|
} else if ((!newIcon || !isNewIconMigratable) && !UNSAFE_size) {
|
|
233
243
|
createCantFindSuitableReplacementError(node, legacyIconImports[node.name].packageName, node.name, errorsManual);
|
|
234
|
-
guidance[locToString(node)] = createGuidance(legacyIconImports[node.name].packageName);
|
|
244
|
+
guidance[locToString(node)] = createGuidance(legacyIconImports[node.name].packageName, isInNewButton);
|
|
235
245
|
} else if ((UNSAFE_size === 'large' || UNSAFE_size === 'xlarge') && UNSAFE_propName) {
|
|
236
246
|
createCantMigrateUnsafeProp(node, UNSAFE_propName, UNSAFE_size, legacyIconImports[node.name].packageName, node.name, errorsManual);
|
|
237
|
-
guidance[locToString(node)] = createGuidance(legacyIconImports[node.name].packageName, UNSAFE_size);
|
|
247
|
+
guidance[locToString(node)] = createGuidance(legacyIconImports[node.name].packageName, isInNewButton, UNSAFE_size);
|
|
238
248
|
} else if (!isInNewButton) {
|
|
239
249
|
createCantMigrateFunctionUnknownError(node, legacyIconImports[node.name].packageName, node.name, errorsManual);
|
|
240
|
-
guidance[locToString(node)] = createGuidance(legacyIconImports[node.name].packageName);
|
|
250
|
+
guidance[locToString(node)] = createGuidance(legacyIconImports[node.name].packageName, isInNewButton);
|
|
241
251
|
}
|
|
242
252
|
}
|
|
243
253
|
};
|
|
@@ -280,11 +290,11 @@ export var createChecks = function createChecks(context) {
|
|
|
280
290
|
var requiredAttributesAfterSpread = new Set(['size', 'primaryColor', 'secondaryColor']);
|
|
281
291
|
var hasSpread = false;
|
|
282
292
|
var hasPrimaryColorProp = false;
|
|
283
|
-
var
|
|
284
|
-
|
|
293
|
+
var _iterator7 = _createForOfIteratorHelper(node.openingElement.attributes),
|
|
294
|
+
_step7;
|
|
285
295
|
try {
|
|
286
|
-
for (
|
|
287
|
-
var attr =
|
|
296
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
297
|
+
var attr = _step7.value;
|
|
288
298
|
// Detect spread props
|
|
289
299
|
if (isNodeOfType(attr, 'JSXSpreadAttribute')) {
|
|
290
300
|
// In case there are more spread props
|
|
@@ -317,9 +327,9 @@ export var createChecks = function createChecks(context) {
|
|
|
317
327
|
}
|
|
318
328
|
}
|
|
319
329
|
} catch (err) {
|
|
320
|
-
|
|
330
|
+
_iterator7.e(err);
|
|
321
331
|
} finally {
|
|
322
|
-
|
|
332
|
+
_iterator7.f();
|
|
323
333
|
}
|
|
324
334
|
var hasManualMigration = false;
|
|
325
335
|
if (primaryColor && !canMigrateColor(primaryColor) || hasPrimaryColorProp && !primaryColor) {
|
|
@@ -333,7 +343,6 @@ export var createChecks = function createChecks(context) {
|
|
|
333
343
|
createCantMigrateSizeUnknown(node, errorsManual, legacyIconImports[name].packageName, name);
|
|
334
344
|
hasManualMigration = true;
|
|
335
345
|
}
|
|
336
|
-
guidance[locToString(node)] = createGuidance(legacyIconImports[name].packageName, size ? size : undefined);
|
|
337
346
|
// Check for unsafe size
|
|
338
347
|
if ((UNSAFE_size === 'large' || UNSAFE_size === 'xlarge') && (UNSAFE_propName === 'UNSAFE_iconAfter_size' || UNSAFE_propName === 'UNSAFE_iconBefore_size' || UNSAFE_propName === 'UNSAFE_size')) {
|
|
339
348
|
createCantMigrateUnsafeProp(node, UNSAFE_propName, UNSAFE_size, legacyIconImports[name].packageName, name, errorsManual);
|
|
@@ -355,14 +364,14 @@ export var createChecks = function createChecks(context) {
|
|
|
355
364
|
hasManualMigration = true;
|
|
356
365
|
}
|
|
357
366
|
var migrationMapObject = getMigrationMapObject(legacyIconImports[name].packageName);
|
|
358
|
-
var iconKey = getIconKey(legacyIconImports[name].packageName);
|
|
359
367
|
var newIcon = migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.newIcon;
|
|
360
368
|
var isNewIconMigratable = canAutoMigrateNewIconBasedOnSize(migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.sizeGuidance[(_size = size) !== null && _size !== void 0 ? _size : 'medium']);
|
|
361
369
|
if (!hasManualMigration && newIcon && isNewIconMigratable) {
|
|
362
|
-
createAutoMigrationError(node, legacyIconImports[name].packageName, name,
|
|
370
|
+
createAutoMigrationError(node, legacyIconImports[name].packageName, name, errorsAuto);
|
|
363
371
|
} else if ((!newIcon || !isNewIconMigratable) && size) {
|
|
364
|
-
createCantFindSuitableReplacementError(node, legacyIconImports[name].packageName, name, errorsManual);
|
|
372
|
+
createCantFindSuitableReplacementError(node, legacyIconImports[name].packageName, name, errorsManual, migrationMapObject ? true : false);
|
|
365
373
|
}
|
|
374
|
+
guidance[locToString(node)] = createGuidance(legacyIconImports[name].packageName, insideNewButton, size && isSize(size) ? size : undefined);
|
|
366
375
|
}
|
|
367
376
|
};
|
|
368
377
|
|
|
@@ -372,20 +381,20 @@ export var createChecks = function createChecks(context) {
|
|
|
372
381
|
*/
|
|
373
382
|
var checkCallExpression = function checkCallExpression(node) {
|
|
374
383
|
if ('arguments' in node && node.arguments.length) {
|
|
375
|
-
var
|
|
376
|
-
|
|
384
|
+
var _iterator8 = _createForOfIteratorHelper(node.arguments),
|
|
385
|
+
_step8;
|
|
377
386
|
try {
|
|
378
|
-
for (
|
|
379
|
-
var arg =
|
|
387
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
388
|
+
var arg = _step8.value;
|
|
380
389
|
if (isNodeOfType(arg, 'Identifier') && arg.name in legacyIconImports && legacyIconImports[arg.name].packageName) {
|
|
381
390
|
createCantMigrateFunctionUnknownError(node, legacyIconImports[arg.name].packageName, arg.name, errorsManual);
|
|
382
391
|
guidance[locToString(node)] = createGuidance(legacyIconImports[arg.name].packageName);
|
|
383
392
|
}
|
|
384
393
|
}
|
|
385
394
|
} catch (err) {
|
|
386
|
-
|
|
395
|
+
_iterator8.e(err);
|
|
387
396
|
} finally {
|
|
388
|
-
|
|
397
|
+
_iterator8.f();
|
|
389
398
|
}
|
|
390
399
|
}
|
|
391
400
|
};
|
|
@@ -401,36 +410,28 @@ export var createChecks = function createChecks(context) {
|
|
|
401
410
|
errorList = _Object$entries$_i[1];
|
|
402
411
|
var node = 'node' in errorList.errors[0] ? errorList.errors[0].node : null;
|
|
403
412
|
if (node) {
|
|
413
|
+
var guidanceMessage = _key in guidance ? guidance[_key] : '';
|
|
404
414
|
context.report({
|
|
405
415
|
node: node,
|
|
406
416
|
messageId: 'noLegacyIconsManualMigration',
|
|
407
417
|
data: {
|
|
408
418
|
iconName: errorList.iconName,
|
|
409
419
|
importSource: errorList.importSource,
|
|
410
|
-
|
|
420
|
+
guidance: isQuietMode ? guidanceMessage : "".concat(guidanceMessage, "For more information see the below errors.\n")
|
|
411
421
|
}
|
|
412
422
|
});
|
|
413
423
|
if (!isQuietMode) {
|
|
414
|
-
var
|
|
415
|
-
|
|
424
|
+
var _iterator9 = _createForOfIteratorHelper(errorList.errors),
|
|
425
|
+
_step9;
|
|
416
426
|
try {
|
|
417
|
-
for (
|
|
418
|
-
var error =
|
|
427
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
428
|
+
var error = _step9.value;
|
|
419
429
|
context.report(error);
|
|
420
430
|
}
|
|
421
431
|
} catch (err) {
|
|
422
|
-
|
|
432
|
+
_iterator9.e(err);
|
|
423
433
|
} finally {
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
if (_key in guidance) {
|
|
427
|
-
context.report({
|
|
428
|
-
node: node,
|
|
429
|
-
messageId: 'guidance',
|
|
430
|
-
data: {
|
|
431
|
-
guidance: guidance[_key]
|
|
432
|
-
}
|
|
433
|
-
});
|
|
434
|
+
_iterator9.f();
|
|
434
435
|
}
|
|
435
436
|
}
|
|
436
437
|
}
|
|
@@ -449,16 +450,11 @@ export var createChecks = function createChecks(context) {
|
|
|
449
450
|
}
|
|
450
451
|
var _node = 'node' in _error ? _error.node : null;
|
|
451
452
|
if (_node) {
|
|
452
|
-
|
|
453
|
-
if (
|
|
454
|
-
|
|
455
|
-
node: _node,
|
|
456
|
-
messageId: 'guidance',
|
|
457
|
-
data: {
|
|
458
|
-
guidance: guidance[_key2]
|
|
459
|
-
}
|
|
460
|
-
});
|
|
453
|
+
var _guidanceMessage = _key2 in guidance ? guidance[_key2] : '';
|
|
454
|
+
if ('data' in _error && _error.data) {
|
|
455
|
+
_error.data.guidance = _guidanceMessage;
|
|
461
456
|
}
|
|
457
|
+
context.report(_error);
|
|
462
458
|
}
|
|
463
459
|
}
|
|
464
460
|
}
|
|
@@ -20,7 +20,7 @@ export var getMigrationMapObject = function getMigrationMapObject(iconPackage) {
|
|
|
20
20
|
* @param iconPackage The name of the legacy icon package
|
|
21
21
|
* @returns The unique identifier for the icon (the part after "@atlaskit/icon/glyph")
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
var getIconKey = function getIconKey(iconPackage) {
|
|
24
24
|
var key = iconPackage.replace(/^@atlaskit\/icon\/glyph\//, '');
|
|
25
25
|
return key;
|
|
26
26
|
};
|
|
@@ -35,39 +35,48 @@ export var canAutoMigrateNewIconBasedOnSize = function canAutoMigrateNewIconBase
|
|
|
35
35
|
/**
|
|
36
36
|
* Creates the written guidance for migrating a legacy icon to a new icon
|
|
37
37
|
*/
|
|
38
|
-
export var createGuidance = function createGuidance(iconPackage
|
|
38
|
+
export var createGuidance = function createGuidance(iconPackage) {
|
|
39
|
+
var insideNewButton = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
40
|
+
var size = arguments.length > 2 ? arguments[2] : undefined;
|
|
39
41
|
var migrationMapObject = getMigrationMapObject(iconPackage);
|
|
40
42
|
if (migrationMapObject) {
|
|
41
43
|
var newIcon = migrationMapObject.newIcon;
|
|
42
44
|
if (!newIcon) {
|
|
43
45
|
return 'No equivalent icon in new set. An option is to contribute a custom icon into icon-labs package instead.\n';
|
|
44
46
|
}
|
|
47
|
+
var buttonGuidanceStr = "Please set 'spacing' property of the new icon to 'none', to ensure appropriate spacing inside `@atlaskit/button`.\n";
|
|
48
|
+
var guidance = '';
|
|
45
49
|
if (size) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
guidance += " Please: ".concat(outcomeDescriptionMap[migrationMapObject.sizeGuidance[size]], "\n");
|
|
50
|
+
if (migrationMapObject.sizeGuidance[size] && canAutoMigrateNewIconBasedOnSize(migrationMapObject.sizeGuidance[size])) {
|
|
51
|
+
guidance += "Fix: Use ".concat(newIcon.name, " from @atlaskit/").concat(newIcon.library, "/").concat(newIcon.type, "/").concat(newIcon.name, " instead.");
|
|
49
52
|
} else {
|
|
50
|
-
guidance +=
|
|
53
|
+
guidance += "No equivalent icon for this size, ".concat(size, ", in new set.");
|
|
51
54
|
}
|
|
52
|
-
|
|
55
|
+
guidance += "".concat(migrationMapObject.sizeGuidance[size] in outcomeDescriptionMap ? " Please: ".concat(outcomeDescriptionMap[migrationMapObject.sizeGuidance[size]]) : ' No migration size advice given.', "\n");
|
|
53
56
|
} else {
|
|
54
|
-
|
|
57
|
+
guidance = "Use ".concat(newIcon.name, " from @atlaskit/").concat(newIcon.library, "/").concat(newIcon.type, "/").concat(newIcon.name, " instead.\nMigration suggestions, depending on the legacy icon size:\n");
|
|
55
58
|
for (var _i = 0, _Object$entries = Object.entries(migrationMapObject.sizeGuidance); _i < _Object$entries.length; _i++) {
|
|
56
59
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
57
60
|
_size = _Object$entries$_i[0],
|
|
58
61
|
value = _Object$entries$_i[1];
|
|
59
|
-
|
|
62
|
+
guidance += "\t- ".concat(_size, ": ");
|
|
60
63
|
if (!(value in outcomeDescriptionMap)) {
|
|
61
|
-
|
|
64
|
+
guidance += 'No migration advice given.\n';
|
|
62
65
|
} else {
|
|
63
|
-
|
|
66
|
+
guidance += "".concat(outcomeDescriptionMap[value], ".\n");
|
|
64
67
|
}
|
|
65
|
-
_guidance;
|
|
66
68
|
}
|
|
67
|
-
return _guidance;
|
|
68
69
|
}
|
|
70
|
+
if (insideNewButton) {
|
|
71
|
+
guidance += buttonGuidanceStr;
|
|
72
|
+
} else if (size && size === 'medium') {
|
|
73
|
+
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";
|
|
74
|
+
} else if (size) {
|
|
75
|
+
guidance += "In the new icon, please use spacing='none'.\n";
|
|
76
|
+
}
|
|
77
|
+
return guidance;
|
|
69
78
|
} else {
|
|
70
|
-
return
|
|
79
|
+
return "Migration suggestions not found for \"".concat(iconPackage, "\".\n");
|
|
71
80
|
}
|
|
72
81
|
};
|
|
73
82
|
|
|
@@ -145,13 +154,14 @@ export var createCantMigrateUnsafeProp = function createCantMigrateUnsafeProp(no
|
|
|
145
154
|
};
|
|
146
155
|
pushManualError(locToString(node), errors, myError, packageName, iconName);
|
|
147
156
|
};
|
|
148
|
-
export var createCantFindSuitableReplacementError = function createCantFindSuitableReplacementError(node, importSource, iconName, errors) {
|
|
157
|
+
export var createCantFindSuitableReplacementError = function createCantFindSuitableReplacementError(node, importSource, iconName, errors, sizeIssue) {
|
|
149
158
|
var myError = {
|
|
150
159
|
node: node,
|
|
151
160
|
messageId: 'cantFindSuitableReplacement',
|
|
152
161
|
data: {
|
|
153
162
|
importSource: importSource,
|
|
154
|
-
iconName: iconName
|
|
163
|
+
iconName: iconName,
|
|
164
|
+
sizeGuidance: sizeIssue ? ' at the current size' : ''
|
|
155
165
|
}
|
|
156
166
|
};
|
|
157
167
|
pushManualError(locToString(node), errors, myError, importSource, iconName);
|
|
@@ -194,18 +204,13 @@ export var createCantMigrateSizeUnknown = function createCantMigrateSizeUnknown(
|
|
|
194
204
|
};
|
|
195
205
|
pushManualError(locToString(node), errors, myError, importSource, iconName);
|
|
196
206
|
};
|
|
197
|
-
export var createAutoMigrationError = function createAutoMigrationError(node, importSource, iconName,
|
|
198
|
-
var migrationKey = newIcon.name === oldIconName ? newIcon.name : "".concat(newIcon.name, "--").concat(oldIconName);
|
|
199
|
-
var newMigrationIconPackage = "@atlaskit/".concat(newIcon.library, "/").concat(newIcon.type, "/migration/").concat(migrationKey);
|
|
207
|
+
export var createAutoMigrationError = function createAutoMigrationError(node, importSource, iconName, errors) {
|
|
200
208
|
var myError = {
|
|
201
209
|
node: node,
|
|
202
210
|
messageId: 'noLegacyIconsAutoMigration',
|
|
203
211
|
data: {
|
|
204
212
|
importSource: importSource,
|
|
205
|
-
iconName: iconName
|
|
206
|
-
newIcon: newIcon.name,
|
|
207
|
-
//TODO: provide size guidance
|
|
208
|
-
newPackage: newMigrationIconPackage
|
|
213
|
+
iconName: iconName
|
|
209
214
|
}
|
|
210
215
|
};
|
|
211
216
|
errors[locToString(node)] = myError;
|
|
@@ -27,17 +27,16 @@ var rule = createLintRule({
|
|
|
27
27
|
additionalProperties: false
|
|
28
28
|
}],
|
|
29
29
|
messages: {
|
|
30
|
-
noLegacyIconsAutoMigration: "Auto Migration:\nLegacy icon '{{iconName}}' from '{{importSource}}' detected.\nAutomatic migration is possible
|
|
31
|
-
noLegacyIconsManualMigration: "Manual Migration:\nLegacy icon '{{iconName}}' from '{{importSource}}' detected.\nAutomatic migration not possible
|
|
32
|
-
cantFindSuitableReplacement: "No suitable replacement found for '{{iconName}}' from '{{importSource}}'
|
|
30
|
+
noLegacyIconsAutoMigration: "Auto Migration:\nLegacy icon '{{iconName}}' from '{{importSource}}' detected.\nAutomatic migration is possible.\n\n{{guidance}}\nAtlassians: See https://go.atlassian.com/icon-migration-guide for details.'",
|
|
31
|
+
noLegacyIconsManualMigration: "Manual Migration:\nLegacy icon '{{iconName}}' from '{{importSource}}' detected.\nAutomatic migration not possible.\n\n{{guidance}}\nAtlassians: See https://go.atlassian.com/icon-migration-guide for details.",
|
|
32
|
+
cantFindSuitableReplacement: "No suitable replacement found for '{{iconName}}' from '{{importSource}}'{{sizeGuidance}}. Please manually migrate this icon.",
|
|
33
33
|
cantMigrateReExport: "'{{exportName}}' is a re-export of icon from '{{packageName}}' and cannot be automatically migrated. Please utilize the export from icons directly.",
|
|
34
34
|
cantMigrateColor: "Primary Color prop has {{colorValue}} which cannot be automatically migrated to color prop in the new Icon API. Please use either an appropriate color.icon, color.link token, or currentColor (as a last resort).",
|
|
35
35
|
cantMigrateSpreadProps: "This usage of Icon uses spread props in a way that can't be automatically migrated. Please explicitly define the following props after spread: '{{missingProps}}' ",
|
|
36
36
|
cantMigrateSizeUnknown: "This usage of Icon sets the size via a variable or function that can't be determined.",
|
|
37
37
|
cantMigrateFunctionUnknown: "'{{iconName}}' from legacy '{{importSource}}' is used in unknown function/component. Please manually migrate this icon.",
|
|
38
38
|
cantMigrateIdentifier: "This icon is passed to other components via a map or array, in a way that can't be automatically migrated. Please manually migrate wherever this expression is used and use the icon components directly.",
|
|
39
|
-
cantMigrateUnsafeProp: "Property '{{propName}}' with value of '{{value}}' is unable to be auto-migrated to the new button. Please manually migrate this icon."
|
|
40
|
-
guidance: "Guidance:\n'{{guidance}}'"
|
|
39
|
+
cantMigrateUnsafeProp: "Property '{{propName}}' with value of '{{value}}' is unable to be auto-migrated to the new button. Please manually migrate this icon."
|
|
41
40
|
}
|
|
42
41
|
},
|
|
43
42
|
create: function create(context) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
var supported = {
|
|
2
2
|
values: {
|
|
3
3
|
ignore: ['auto', 'initial', 'inherit', 'unset', 'revert', 'revert-layer',
|
|
4
4
|
// Currently the DST opinion is that 0 is valid. It doesn't need to be converted to `space.0`
|
|
5
5
|
'0', '0 auto', 'space.negative.025', 'space.negative.050', 'space.negative.075', 'space.negative.100', 'space.negative.150', 'space.negative.200', 'space.negative.250', 'space.negative.300', 'space.negative.400', 'space.0', 'space.025', 'space.050', 'space.075', 'space.100', 'space.150', 'space.200', 'space.250', 'space.300', 'space.400', 'space.500', 'space.600', 'space.800', 'space.1000']
|
|
6
6
|
}
|
|
7
|
-
};
|
|
7
|
+
};
|
|
8
|
+
export default supported;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
var supported = {
|
|
2
2
|
values: {
|
|
3
3
|
ignore: ['auto', 'initial', 'inherit', 'unset', 'revert', 'revert-layer', 'none',
|
|
4
4
|
// outline-offset can be set to none
|
|
5
5
|
// Currently the DST opinion is that 0 is valid. It doesn't need to be converted to `space.0`
|
|
6
6
|
0, '0', '0px', '0em', '0rem']
|
|
7
7
|
}
|
|
8
|
-
};
|
|
8
|
+
};
|
|
9
|
+
export default supported;
|
|
@@ -4,7 +4,7 @@ import { closestOfType } from 'eslint-codemod-utils';
|
|
|
4
4
|
import { getImportedNodeBySource } from '../utils/get-import-node-by-source';
|
|
5
5
|
import { IMPORT_NAME, VISUALLY_HIDDEN_IMPORT, VISUALLY_HIDDEN_SOURCE } from './constants';
|
|
6
6
|
import { getFirstImport } from './utils';
|
|
7
|
-
|
|
7
|
+
var fixJsx = function fixJsx(source, node) {
|
|
8
8
|
return function (fixer) {
|
|
9
9
|
var fixes = [];
|
|
10
10
|
var importedNode = getFirstImport(source);
|
|
@@ -21,4 +21,5 @@ export default (function (source, node) {
|
|
|
21
21
|
}
|
|
22
22
|
return fixes;
|
|
23
23
|
};
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
|
+
export default fixJsx;
|