@atlaskit/eslint-plugin-design-system 10.9.0 → 10.10.1
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/README.md +1 -0
- package/dist/cjs/presets/all.codegen.js +2 -1
- package/dist/cjs/rules/ensure-design-token-usage/index.js +199 -227
- package/dist/cjs/rules/index.codegen.js +3 -1
- package/dist/cjs/rules/no-custom-icons/checks/has-prop.js +12 -0
- package/dist/cjs/rules/no-custom-icons/checks/is-from-import-source.js +42 -0
- package/dist/cjs/rules/no-custom-icons/checks/is-imported-jsx-element.js +10 -0
- package/dist/cjs/rules/no-custom-icons/index.js +67 -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 +15 -88
- package/dist/cjs/rules/use-tokens-typography/index.js +4 -8
- package/dist/cjs/rules/utils/error-boundary.js +58 -11
- package/dist/es2019/presets/all.codegen.js +2 -1
- package/dist/es2019/rules/ensure-design-token-usage/index.js +16 -30
- package/dist/es2019/rules/index.codegen.js +3 -1
- package/dist/es2019/rules/no-custom-icons/checks/has-prop.js +4 -0
- package/dist/es2019/rules/no-custom-icons/checks/is-from-import-source.js +23 -0
- package/dist/es2019/rules/no-custom-icons/checks/is-imported-jsx-element.js +4 -0
- package/dist/es2019/rules/no-custom-icons/index.js +61 -0
- 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 +15 -70
- package/dist/es2019/rules/use-tokens-typography/index.js +3 -7
- package/dist/es2019/rules/utils/error-boundary.js +55 -11
- package/dist/esm/presets/all.codegen.js +2 -1
- package/dist/esm/rules/ensure-design-token-usage/index.js +199 -227
- package/dist/esm/rules/index.codegen.js +3 -1
- package/dist/esm/rules/no-custom-icons/checks/has-prop.js +6 -0
- package/dist/esm/rules/no-custom-icons/checks/is-from-import-source.js +36 -0
- package/dist/esm/rules/no-custom-icons/checks/is-imported-jsx-element.js +4 -0
- package/dist/esm/rules/no-custom-icons/index.js +61 -0
- 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 +15 -88
- package/dist/esm/rules/use-tokens-typography/index.js +4 -8
- package/dist/esm/rules/utils/error-boundary.js +56 -10
- package/dist/types/index.codegen.d.ts +1 -0
- package/dist/types/presets/all.codegen.d.ts +2 -1
- package/dist/types/rules/index.codegen.d.ts +1 -0
- package/dist/types/rules/no-custom-icons/checks/has-prop.d.ts +2 -0
- package/dist/types/rules/no-custom-icons/checks/is-from-import-source.d.ts +8 -0
- package/dist/types/rules/no-custom-icons/checks/is-imported-jsx-element.d.ts +8 -0
- package/dist/types/rules/no-custom-icons/index.d.ts +3 -0
- package/dist/types/rules/no-legacy-icons/helpers.d.ts +3 -13
- package/dist/types/rules/no-legacy-icons/index.d.ts +1 -2
- package/dist/types/rules/utils/error-boundary.d.ts +8 -5
- package/dist/types-ts4.5/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
- package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/rules/no-custom-icons/checks/has-prop.d.ts +2 -0
- package/dist/types-ts4.5/rules/no-custom-icons/checks/is-from-import-source.d.ts +8 -0
- package/dist/types-ts4.5/rules/no-custom-icons/checks/is-imported-jsx-element.d.ts +8 -0
- package/dist/types-ts4.5/rules/no-custom-icons/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +3 -13
- package/dist/types-ts4.5/rules/no-legacy-icons/index.d.ts +1 -2
- package/dist/types-ts4.5/rules/utils/error-boundary.d.ts +8 -5
- 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 -56
- package/constellation/no-banned-imports/usage.mdx +0 -19
- package/constellation/no-css-tagged-template-expression/usage.mdx +0 -71
- 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
|
@@ -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) {
|
|
@@ -54,95 +53,23 @@ var rule = createLintRule({
|
|
|
54
53
|
checkJSXElement = _createChecks.checkJSXElement,
|
|
55
54
|
checkCallExpression = _createChecks.checkCallExpression,
|
|
56
55
|
throwErrors = _createChecks.throwErrors;
|
|
57
|
-
return {
|
|
56
|
+
return errorBoundary({
|
|
58
57
|
// Track imports of relevant components
|
|
59
|
-
ImportDeclaration:
|
|
60
|
-
errorBoundary(function () {
|
|
61
|
-
return checkImportDeclarations(node);
|
|
62
|
-
}, {
|
|
63
|
-
config: {
|
|
64
|
-
failSilently: failSilently
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
},
|
|
58
|
+
ImportDeclaration: checkImportDeclarations,
|
|
68
59
|
// Keep track of the relevant variable declarations and renames
|
|
69
|
-
VariableDeclaration:
|
|
70
|
-
errorBoundary(function () {
|
|
71
|
-
return checkVariableDeclarations(node);
|
|
72
|
-
}, {
|
|
73
|
-
config: {
|
|
74
|
-
failSilently: failSilently
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
},
|
|
60
|
+
VariableDeclaration: checkVariableDeclarations,
|
|
78
61
|
// Case: default re-exports. Can't be auto-migrated
|
|
79
|
-
ExportDefaultDeclaration:
|
|
80
|
-
|
|
81
|
-
return checkExportDefaultDeclaration(node);
|
|
82
|
-
}, {
|
|
83
|
-
config: {
|
|
84
|
-
failSilently: failSilently
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
ExportNamedDeclaration: function ExportNamedDeclaration(node) {
|
|
89
|
-
errorBoundary(function () {
|
|
90
|
-
return checkExportNamedVariables(node);
|
|
91
|
-
}, {
|
|
92
|
-
config: {
|
|
93
|
-
failSilently: failSilently
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
},
|
|
62
|
+
ExportDefaultDeclaration: checkExportDefaultDeclaration,
|
|
63
|
+
ExportNamedDeclaration: checkExportNamedVariables,
|
|
97
64
|
// Legacy icons found in arrays/objects
|
|
98
|
-
'ObjectExpression > Property > Identifier, ArrayExpression > Identifier ':
|
|
99
|
-
errorBoundary(function () {
|
|
100
|
-
return checkArrayOrMap(node);
|
|
101
|
-
}, {
|
|
102
|
-
config: {
|
|
103
|
-
failSilently: failSilently
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
},
|
|
65
|
+
'ObjectExpression > Property > Identifier, ArrayExpression > Identifier ': checkArrayOrMap,
|
|
107
66
|
// Legacy icons passed in via props, as JSX identifier (i.e. icon={AddIcon})
|
|
108
|
-
'JSXOpeningElement > JSXAttribute > JSXExpressionContainer > Identifier':
|
|
109
|
-
|
|
110
|
-
return checkIconAsProp(node);
|
|
111
|
-
}, {
|
|
112
|
-
config: {
|
|
113
|
-
failSilently: failSilently
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
},
|
|
117
|
-
JSXElement: function JSXElement(node) {
|
|
118
|
-
errorBoundary(function () {
|
|
119
|
-
return checkJSXElement(node);
|
|
120
|
-
}, {
|
|
121
|
-
config: {
|
|
122
|
-
failSilently: failSilently
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
},
|
|
67
|
+
'JSXOpeningElement > JSXAttribute > JSXExpressionContainer > Identifier': checkIconAsProp,
|
|
68
|
+
JSXElement: checkJSXElement,
|
|
126
69
|
// Icons called as an argument of a function (i.e. icon={DefaultIcon(AddIcon)})
|
|
127
|
-
CallExpression:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}, {
|
|
131
|
-
config: {
|
|
132
|
-
failSilently: failSilently
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
},
|
|
136
|
-
'Program:exit': function ProgramExit() {
|
|
137
|
-
errorBoundary(function () {
|
|
138
|
-
return throwErrors();
|
|
139
|
-
}, {
|
|
140
|
-
config: {
|
|
141
|
-
failSilently: failSilently
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
};
|
|
70
|
+
CallExpression: checkCallExpression,
|
|
71
|
+
'Program:exit': throwErrors
|
|
72
|
+
}, failSilently);
|
|
146
73
|
}
|
|
147
74
|
});
|
|
148
75
|
export default rule;
|
|
@@ -6,16 +6,12 @@ var create = function create(context) {
|
|
|
6
6
|
var config = getConfig(context.options[0]);
|
|
7
7
|
return {
|
|
8
8
|
// const styles = css({ fontSize: '14px, ... }), styled.div({ fontSize: 14, ... })
|
|
9
|
-
ObjectExpression: function
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
context: context,
|
|
13
|
-
config: config
|
|
14
|
-
});
|
|
15
|
-
}, {
|
|
9
|
+
ObjectExpression: errorBoundary(function (node) {
|
|
10
|
+
return StyleObject.lint(node, {
|
|
11
|
+
context: context,
|
|
16
12
|
config: config
|
|
17
13
|
});
|
|
18
|
-
}
|
|
14
|
+
}, config)
|
|
19
15
|
};
|
|
20
16
|
};
|
|
21
17
|
var rule = createLintRule({
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
3
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
|
+
|
|
5
|
+
// Need to intersect type RuleListener with a generic function to allow use of Parameters<...> to be used
|
|
6
|
+
|
|
7
|
+
// Allow config to be to be easily passed from rules
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
10
|
* ESLint rules should NEVER throw exceptions, because that breaks the VSCode ESLint server
|
|
3
11
|
* (and probably the IntelliJ one too), which causes linting to fail in a file.
|
|
@@ -5,14 +13,52 @@
|
|
|
5
13
|
* It also breaks CI, which was the reason this error boundary was added. It's a final
|
|
6
14
|
* catch all.
|
|
7
15
|
*/
|
|
8
|
-
export
|
|
9
|
-
var config =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
export function errorBoundary(ruleOrRules) {
|
|
17
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
18
|
+
var failSilently = failSilentlyFromConfig(config);
|
|
19
|
+
if (isSingleRuleListener(ruleOrRules)) {
|
|
20
|
+
return wrapSingleRuleListener(ruleOrRules, failSilently);
|
|
21
|
+
}
|
|
22
|
+
return wrapRuleListener(ruleOrRules, failSilently);
|
|
23
|
+
}
|
|
24
|
+
function isSingleRuleListener(rule) {
|
|
25
|
+
return typeof rule === 'function';
|
|
26
|
+
}
|
|
27
|
+
function failSilentlyFromConfig(c) {
|
|
28
|
+
switch (_typeof(c)) {
|
|
29
|
+
case 'undefined':
|
|
30
|
+
return false;
|
|
31
|
+
case 'boolean':
|
|
32
|
+
return c;
|
|
33
|
+
case 'object':
|
|
34
|
+
if ('failSilently' in c) {
|
|
35
|
+
var _c$failSilently;
|
|
36
|
+
return (_c$failSilently = c.failSilently) !== null && _c$failSilently !== void 0 ? _c$failSilently : false;
|
|
37
|
+
} else if ('config' in c) {
|
|
38
|
+
var _c$config$failSilentl;
|
|
39
|
+
return (_c$config$failSilentl = c.config.failSilently) !== null && _c$config$failSilentl !== void 0 ? _c$config$failSilentl : false;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
default:
|
|
43
|
+
throw new Error('Invalid config');
|
|
17
44
|
}
|
|
18
|
-
}
|
|
45
|
+
}
|
|
46
|
+
function wrapSingleRuleListener(rule, failSilently) {
|
|
47
|
+
return function () {
|
|
48
|
+
try {
|
|
49
|
+
rule.apply(void 0, arguments);
|
|
50
|
+
} catch (err) {
|
|
51
|
+
if (!failSilently) {
|
|
52
|
+
// eslint-disable-next-line no-console
|
|
53
|
+
console.warn(err);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function wrapRuleListener(ruleListener, failSilently) {
|
|
59
|
+
return Object.entries(ruleListener).reduce(function (wrappedRuleListener, e) {
|
|
60
|
+
var ruleName = e[0];
|
|
61
|
+
var rule = e[1];
|
|
62
|
+
return Object.assign(wrappedRuleListener, _defineProperty({}, ruleName, wrapSingleRuleListener(rule, failSilently)));
|
|
63
|
+
}, {});
|
|
64
|
+
}
|
|
@@ -9,6 +9,7 @@ export declare const configs: {
|
|
|
9
9
|
'@atlaskit/design-system/icon-label': string;
|
|
10
10
|
'@atlaskit/design-system/no-banned-imports': string;
|
|
11
11
|
'@atlaskit/design-system/no-css-tagged-template-expression': string;
|
|
12
|
+
'@atlaskit/design-system/no-custom-icons': string;
|
|
12
13
|
'@atlaskit/design-system/no-deprecated-apis': string;
|
|
13
14
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
14
15
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::ab43b6e1a867d07b9a27eae78d48834a>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -12,6 +12,7 @@ declare const _default: {
|
|
|
12
12
|
'@atlaskit/design-system/icon-label': string;
|
|
13
13
|
'@atlaskit/design-system/no-banned-imports': string;
|
|
14
14
|
'@atlaskit/design-system/no-css-tagged-template-expression': string;
|
|
15
|
+
'@atlaskit/design-system/no-custom-icons': string;
|
|
15
16
|
'@atlaskit/design-system/no-deprecated-apis': string;
|
|
16
17
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
17
18
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
@@ -5,6 +5,7 @@ declare const _default: {
|
|
|
5
5
|
'icon-label': import("eslint").Rule.RuleModule;
|
|
6
6
|
'no-banned-imports': import("eslint").Rule.RuleModule;
|
|
7
7
|
'no-css-tagged-template-expression': import("eslint").Rule.RuleModule;
|
|
8
|
+
'no-custom-icons': import("eslint").Rule.RuleModule;
|
|
8
9
|
'no-deprecated-apis': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<string, [{
|
|
9
10
|
deprecatedConfig: import("./utils/types").DeprecatedConfig;
|
|
10
11
|
}], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import type { ImportDeclaration } from 'eslint-codemod-utils';
|
|
3
|
+
import { type ImportedJSXElement } from './is-imported-jsx-element';
|
|
4
|
+
export declare function createIsFromImportSourceFor(...importSources: (string | RegExp)[]): {
|
|
5
|
+
(node: Rule.Node): node is ImportedJSXElement;
|
|
6
|
+
importDeclarationHook(node: ImportDeclaration): void;
|
|
7
|
+
getImportSource(node: Rule.Node): string;
|
|
8
|
+
};
|