@atlaskit/eslint-plugin-design-system 13.41.2 → 13.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +0 -1
  3. package/dist/cjs/presets/all-flat.codegen.js +1 -2
  4. package/dist/cjs/presets/all.codegen.js +1 -2
  5. package/dist/cjs/rules/index.codegen.js +1 -3
  6. package/dist/cjs/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +5 -4
  7. package/dist/es2019/presets/all-flat.codegen.js +1 -2
  8. package/dist/es2019/presets/all.codegen.js +1 -2
  9. package/dist/es2019/rules/index.codegen.js +1 -3
  10. package/dist/es2019/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +5 -4
  11. package/dist/esm/presets/all-flat.codegen.js +1 -2
  12. package/dist/esm/presets/all.codegen.js +1 -2
  13. package/dist/esm/rules/index.codegen.js +1 -3
  14. package/dist/esm/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +5 -4
  15. package/dist/types/presets/all-flat.codegen.d.ts +1 -1
  16. package/dist/types/presets/all.codegen.d.ts +1 -1
  17. package/dist/types/rules/ensure-design-token-usage/index.d.ts +1 -1
  18. package/dist/types/rules/ensure-design-token-usage/rule-meta.d.ts +1 -1
  19. package/dist/types/rules/ensure-design-token-usage/utils.d.ts +1 -1
  20. package/dist/types/rules/index.codegen.d.ts +1 -1
  21. package/dist/types/rules/no-deprecated-imports/handlers/icon.d.ts +1 -1
  22. package/dist/types/rules/use-heading/transformers/common.d.ts +2 -2
  23. package/dist/types/rules/use-latest-xcss-syntax-typography/linters/common.d.ts +1 -1
  24. package/dist/types/rules/use-latest-xcss-syntax-typography/linters/wrapped-token-value.d.ts +1 -1
  25. package/dist/types/rules/use-primitives/transformers/compiled-styled/index.d.ts +1 -1
  26. package/dist/types/rules/use-primitives/transformers/emotion-css/index.d.ts +1 -1
  27. package/dist/types/rules/use-primitives/utils/is-valid-css-properties-to-transform.d.ts +1 -1
  28. package/dist/types/rules/use-primitives/utils/validate-styles.d.ts +1 -1
  29. package/dist/types/rules/use-primitives-text/transformers/common.d.ts +1 -1
  30. package/dist/types/rules/use-primitives-text/transformers/unsafe-small-text.d.ts +1 -1
  31. package/dist/types/rules/use-tokens-typography/config/index.d.ts +1 -1
  32. package/dist/types/rules/use-tokens-typography/transformers/banned-properties.d.ts +1 -1
  33. package/dist/types/rules/use-tokens-typography/transformers/font-family.d.ts +1 -1
  34. package/dist/types/rules/use-tokens-typography/transformers/font-weight.d.ts +1 -1
  35. package/dist/types/rules/use-tokens-typography/transformers/restricted-capitalisation.d.ts +1 -1
  36. package/dist/types/rules/use-tokens-typography/transformers/style-object.d.ts +1 -1
  37. package/dist/types/rules/use-tokens-typography/transformers/untokenized-properties.d.ts +1 -1
  38. package/dist/types/rules/utils/create-no-exported-rule/check-if-supported-export.d.ts +1 -1
  39. package/dist/types/rules/utils/get-first-supported-import.d.ts +1 -1
  40. package/dist/types-ts4.5/presets/all-flat.codegen.d.ts +1 -1
  41. package/dist/types-ts4.5/presets/all.codegen.d.ts +1 -1
  42. package/dist/types-ts4.5/rules/ensure-design-token-usage/index.d.ts +1 -1
  43. package/dist/types-ts4.5/rules/ensure-design-token-usage/rule-meta.d.ts +1 -1
  44. package/dist/types-ts4.5/rules/ensure-design-token-usage/utils.d.ts +1 -1
  45. package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -1
  46. package/dist/types-ts4.5/rules/no-deprecated-imports/handlers/icon.d.ts +1 -1
  47. package/dist/types-ts4.5/rules/use-heading/transformers/common.d.ts +2 -2
  48. package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/linters/common.d.ts +1 -1
  49. package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/linters/wrapped-token-value.d.ts +1 -1
  50. package/dist/types-ts4.5/rules/use-primitives/transformers/compiled-styled/index.d.ts +1 -1
  51. package/dist/types-ts4.5/rules/use-primitives/transformers/emotion-css/index.d.ts +1 -1
  52. package/dist/types-ts4.5/rules/use-primitives/utils/is-valid-css-properties-to-transform.d.ts +1 -1
  53. package/dist/types-ts4.5/rules/use-primitives/utils/validate-styles.d.ts +1 -1
  54. package/dist/types-ts4.5/rules/use-primitives-text/transformers/common.d.ts +1 -1
  55. package/dist/types-ts4.5/rules/use-primitives-text/transformers/unsafe-small-text.d.ts +1 -1
  56. package/dist/types-ts4.5/rules/use-tokens-typography/config/index.d.ts +1 -1
  57. package/dist/types-ts4.5/rules/use-tokens-typography/transformers/banned-properties.d.ts +1 -1
  58. package/dist/types-ts4.5/rules/use-tokens-typography/transformers/font-family.d.ts +1 -1
  59. package/dist/types-ts4.5/rules/use-tokens-typography/transformers/font-weight.d.ts +1 -1
  60. package/dist/types-ts4.5/rules/use-tokens-typography/transformers/restricted-capitalisation.d.ts +1 -1
  61. package/dist/types-ts4.5/rules/use-tokens-typography/transformers/style-object.d.ts +1 -1
  62. package/dist/types-ts4.5/rules/use-tokens-typography/transformers/untokenized-properties.d.ts +1 -1
  63. package/dist/types-ts4.5/rules/utils/create-no-exported-rule/check-if-supported-export.d.ts +1 -1
  64. package/dist/types-ts4.5/rules/utils/get-first-supported-import.d.ts +1 -1
  65. package/package.json +4 -4
  66. package/dist/cjs/rules/no-legacy-icons/checks.js +0 -619
  67. package/dist/cjs/rules/no-legacy-icons/helpers.js +0 -900
  68. package/dist/cjs/rules/no-legacy-icons/index.js +0 -91
  69. package/dist/cjs/rules/no-legacy-icons/upcoming-icons.js +0 -7
  70. package/dist/es2019/rules/no-legacy-icons/checks.js +0 -520
  71. package/dist/es2019/rules/no-legacy-icons/helpers.js +0 -853
  72. package/dist/es2019/rules/no-legacy-icons/index.js +0 -87
  73. package/dist/es2019/rules/no-legacy-icons/upcoming-icons.js +0 -1
  74. package/dist/esm/rules/no-legacy-icons/checks.js +0 -613
  75. package/dist/esm/rules/no-legacy-icons/helpers.js +0 -891
  76. package/dist/esm/rules/no-legacy-icons/index.js +0 -85
  77. package/dist/esm/rules/no-legacy-icons/upcoming-icons.js +0 -1
  78. package/dist/types/rules/no-legacy-icons/checks.d.ts +0 -16
  79. package/dist/types/rules/no-legacy-icons/helpers.d.ts +0 -151
  80. package/dist/types/rules/no-legacy-icons/index.d.ts +0 -2
  81. package/dist/types/rules/no-legacy-icons/upcoming-icons.d.ts +0 -1
  82. package/dist/types-ts4.5/rules/no-legacy-icons/checks.d.ts +0 -16
  83. package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +0 -156
  84. package/dist/types-ts4.5/rules/no-legacy-icons/index.d.ts +0 -2
  85. package/dist/types-ts4.5/rules/no-legacy-icons/upcoming-icons.d.ts +0 -1
@@ -1,85 +0,0 @@
1
- import { createLintRule } from '../utils/create-rule';
2
- import { errorBoundary } from '../utils/error-boundary';
3
- import { createChecks } from './checks';
4
- import { createHelpers } from './helpers';
5
- var rule = createLintRule({
6
- meta: {
7
- name: 'no-legacy-icons',
8
- fixable: 'code',
9
- hasSuggestions: true,
10
- type: 'problem',
11
- docs: {
12
- description: 'Enforces no legacy icons are used.',
13
- recommended: false,
14
- severity: 'warn'
15
- },
16
- schema: [{
17
- type: 'object',
18
- properties: {
19
- shouldErrorForManualMigration: {
20
- type: 'boolean'
21
- },
22
- shouldErrorForAutoMigration: {
23
- type: 'boolean'
24
- },
25
- shouldUseSafeMigrationMode: {
26
- type: 'boolean'
27
- },
28
- quiet: {
29
- type: 'boolean'
30
- },
31
- shouldUseMigrationPath: {
32
- type: 'boolean'
33
- }
34
- },
35
- additionalProperties: false
36
- }],
37
- messages: {
38
- 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.'",
39
- 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.",
40
- cantFindSuitableReplacement: "No suitable replacement found for '{{iconName}}' from '{{importSource}}'{{sizeGuidance}}. Please manually migrate this icon.",
41
- cantMigrateReExport: "'{{exportName}}' is a re-export of icon from '{{packageName}}' and cannot be automatically migrated. Please remove this re-export, and migrate any usages to the new icon APIs.",
42
- cantMigrateColor: "This icon's `primaryColor` prop is set to {{colorValue}}, which isn't a design token supported in the new Icon API. Please switch to an appropriate `color.icon`, `color.link` or `color.text` token, or currentColor in buttons and menus.",
43
- 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 in order to auto-migrate: '{{missingProps}}' ",
44
- cantMigrateSizeUnknown: "This usage of Icon sets the size via a variable or function that can't be automatically migrated. Please migrate manually to the correct `LEGACY_size` and `spacing` props.",
45
- cantMigrateFunctionUnknown: "Icon '{{iconName}}', from entrypoint '{{importSource}}', is passed into a function/component and can't be migrated automatically. Please manually migrate this icon.",
46
- cantMigrateIdentifierMapOrArray: "This icon is passed to other components via a map or array, and can't be migrated automatically. Please manually migrate wherever this expression is used to the new API, or use the icon components directly.",
47
- cantMigrateIdentifier: "This reference to {{iconName}} from {{iconSource}} can't be migrated automatically to the new components and API. Please manually migrate this and any other references."
48
- }
49
- },
50
- create: function create(context) {
51
- var _createHelpers = createHelpers(context),
52
- getConfigFlag = _createHelpers.getConfigFlag;
53
- var failSilently = getConfigFlag('failSilently', false);
54
- var _createChecks = createChecks(context),
55
- checkImportDeclarations = _createChecks.checkImportDeclarations,
56
- checkVariableDeclarations = _createChecks.checkVariableDeclarations,
57
- checkExportDefaultDeclaration = _createChecks.checkExportDefaultDeclaration,
58
- checkExportNamedVariables = _createChecks.checkExportNamedVariables,
59
- checkArrayOrMap = _createChecks.checkArrayOrMap,
60
- checkIconAsProp = _createChecks.checkIconAsProp,
61
- checkJSXElement = _createChecks.checkJSXElement,
62
- checkCallExpression = _createChecks.checkCallExpression,
63
- throwErrors = _createChecks.throwErrors,
64
- checkIconReference = _createChecks.checkIconReference;
65
- return errorBoundary({
66
- // Track imports of relevant components
67
- ImportDeclaration: checkImportDeclarations,
68
- // Keep track of the relevant variable declarations and renames
69
- VariableDeclaration: checkVariableDeclarations,
70
- // Case: default re-exports. Can't be auto-migrated
71
- ExportDefaultDeclaration: checkExportDefaultDeclaration,
72
- ExportNamedDeclaration: checkExportNamedVariables,
73
- // Legacy icons found in arrays/objects
74
- 'ObjectExpression > Property > Identifier, ArrayExpression > Identifier ': checkArrayOrMap,
75
- // Legacy icons passed in via props, as JSX identifier (i.e. icon={AddIcon})
76
- 'JSXOpeningElement > JSXAttribute > JSXExpressionContainer > Identifier': checkIconAsProp,
77
- JSXElement: checkJSXElement,
78
- // Icons called as an argument of a function (i.e. icon={DefaultIcon(AddIcon)})
79
- CallExpression: checkCallExpression,
80
- Identifier: checkIconReference,
81
- 'Program:exit': throwErrors
82
- }, failSilently);
83
- }
84
- });
85
- export default rule;
@@ -1 +0,0 @@
1
- export var upcomingIcons = [];
@@ -1,16 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- import { type CallExpression, type ExportDefaultDeclaration, type ExportNamedDeclaration, type Identifier, type ImportDeclaration, type VariableDeclaration } from 'eslint-codemod-utils';
3
- type ReturnObject = {
4
- checkImportDeclarations: (node: ImportDeclaration & Rule.NodeParentExtension) => void;
5
- checkVariableDeclarations: (node: VariableDeclaration & Rule.NodeParentExtension) => void;
6
- checkExportDefaultDeclaration: (node: ExportDefaultDeclaration & Rule.NodeParentExtension) => void;
7
- checkExportNamedVariables: (node: ExportNamedDeclaration & Rule.NodeParentExtension) => void;
8
- checkArrayOrMap: (node: Identifier) => void;
9
- checkIconAsProp: (node: Identifier) => void;
10
- checkIconReference: (node: Identifier & Rule.NodeParentExtension) => void;
11
- checkJSXElement: (node: Rule.Node) => void;
12
- checkCallExpression: (node: CallExpression & Rule.NodeParentExtension) => void;
13
- throwErrors: () => void;
14
- };
15
- export declare const createChecks: (context: Rule.RuleContext) => ReturnObject;
16
- export {};
@@ -1,151 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- import { type ImportDeclaration, type JSXAttribute, type Node } from 'eslint-codemod-utils';
3
- import { type IconMigrationSizeGuidance } from '@atlaskit/icon/migration-map';
4
- export type IconMigrationError = Rule.ReportDescriptor;
5
- export type RangeList = {
6
- start: number;
7
- end: number;
8
- }[];
9
- export type ErrorListManual = {
10
- [loc: string]: {
11
- errors: IconMigrationError[];
12
- iconName: string;
13
- importSource: string;
14
- };
15
- };
16
- export type ErrorListAuto = {
17
- [loc: string]: IconMigrationError;
18
- };
19
- export type GuidanceList = {
20
- [loc: string]: string;
21
- };
22
- export type LegacyIconImportList = {
23
- [key: string]: {
24
- packageName: string;
25
- exported: boolean;
26
- importNode: ImportDeclaration;
27
- importSpecifier: string;
28
- };
29
- };
30
- export type MigrationIconImportList = {
31
- [key: string]: {
32
- packageName: string;
33
- exported: boolean;
34
- importNode: ImportDeclaration;
35
- importSpecifier: string;
36
- };
37
- };
38
- declare const sizes: readonly ["small", "medium", "large", "xlarge"];
39
- export type Size = (typeof sizes)[number];
40
- export declare const isSize: (size: any) => size is Size;
41
- /**
42
- * Returns the migration map object for a legacy icon or null if not found
43
- * @param iconPackage The name of the legacy icon package
44
- * @returns The migration map object for the legacy icon or null if not found
45
- */
46
- export declare const getMigrationMapObject: (iconPackage: string) => {
47
- newIcon?: {
48
- name: string;
49
- package: string;
50
- isMigrationUnsafe?: boolean;
51
- shouldForceSmallIcon?: boolean;
52
- };
53
- additionalIcons?: {
54
- name: string;
55
- package: string;
56
- }[];
57
- sizeGuidance: Record<Size, IconMigrationSizeGuidance>;
58
- } | null;
59
- export declare const getUpcomingIcons: (iconPackage: string) => {
60
- sizeGuidance: Record<Size, IconMigrationSizeGuidance>;
61
- } | null;
62
- /**
63
- * Checks if a new icon can be auto-migrated based on guidance from the migration map
64
- */
65
- export declare const canAutoMigrateNewIconBasedOnSize: (guidance?: IconMigrationSizeGuidance) => boolean;
66
- /**
67
- * Creates the written guidance for migrating a legacy icon to a new icon
68
- */
69
- export declare const createGuidance: (props: {
70
- iconPackage: string;
71
- insideNewButton?: boolean;
72
- size?: Size;
73
- shouldUseMigrationPath?: boolean;
74
- shouldForceSmallIcon?: boolean;
75
- }) => string;
76
- /**
77
- * Checks if the color can be migrated
78
- * @param color String representing the color to check
79
- * @returns True if the color can be migrated, false otherwise
80
- */
81
- export declare const canMigrateColor: (color: string) => boolean;
82
- export declare const locToString: (node: Node) => string;
83
- export declare const createCantMigrateReExportError: (node: Node, packageName: string, exportName: string, errors: ErrorListManual) => void;
84
- export declare const createCantMigrateIdentifierMapOrArrayError: (node: Node, packageName: string, exportName: string, errors: ErrorListManual) => void;
85
- export declare const createCantMigrateIdentifierError: (node: Node, packageName: string, exportName: string, errors: ErrorListManual) => void;
86
- export declare const createCantFindSuitableReplacementError: (node: Node, importSource: string, iconName: string, errors: ErrorListManual, sizeIssue?: boolean) => void;
87
- export declare const createCantMigrateFunctionUnknownError: (node: Node, importSource: string, iconName: string, errors: ErrorListManual) => void;
88
- export declare const createCantMigrateColorError: (node: Node, colorValue: string, errors: ErrorListManual, importSource: string, iconName: string) => void;
89
- export declare const createCantMigrateSpreadPropsError: (node: Node, missingProps: string[], errors: ErrorListManual, importSource: string, iconName: string) => void;
90
- export declare const createCantMigrateSizeUnknown: (node: Node, errors: ErrorListManual, importSource: string, iconName: string) => void;
91
- export declare const createAutoMigrationError: ({ node, importSource, iconName, errors, spacing, insideNewButton, shouldForceSmallIcon, }: {
92
- node: Node;
93
- importSource: string;
94
- iconName: string;
95
- errors: ErrorListAuto;
96
- spacing?: string;
97
- insideNewButton?: boolean;
98
- shouldForceSmallIcon?: boolean;
99
- }) => void;
100
- export declare const createHelpers: (ctx: Rule.RuleContext) => {
101
- /**
102
- * Extracts the primaryColor value from a JSXAttribute
103
- */
104
- getPrimaryColor(attr: JSXAttribute): string | null;
105
- getTokenCallValue: (value: any) => string | undefined;
106
- getConfigFlag: (key: string, defaultValue: boolean) => boolean;
107
- };
108
- export declare const addToListOfRanges: (node: Node, sortedListOfRangesForErrors: RangeList) => void;
109
- /**
110
- *
111
- * @param node Icon JSXelement
112
- * @param newButtonImports list of new button import specifiers
113
- * @returns if Icon is inside a new button
114
- */
115
- export declare const isInsideNewButton: (node: Rule.Node, newButtonImports: Set<string>) => boolean;
116
- /**
117
- *
118
- * @param node Icon JSXelement
119
- * @param newButtonImports list of legacy button import specifiers
120
- * @returns if Icon is inside a legacy button
121
- */
122
- export declare const isInsideLegacyButton: (node: Rule.Node, legacyButtonImports: Set<string>) => boolean;
123
- /**
124
- *
125
- * @param node Icon JSXelement
126
- * @param newButtonImports list of legacy button import specifiers
127
- * @returns if Icon is inside a legacy button
128
- */
129
- export declare const isInsideIconOnlyLegacyButton: (node: Rule.Node, legacyButtonImports: Set<string>) => boolean;
130
- export declare const getComponentName: (name: string) => string;
131
- export declare const throwManualErrors: ({ errorsManual, errorRanges, guidance, context, isQuietMode, }: {
132
- errorsManual: ErrorListManual;
133
- errorRanges: RangeList;
134
- guidance: GuidanceList;
135
- context: Rule.RuleContext;
136
- isQuietMode: boolean;
137
- }) => void;
138
- export declare const throwAutoErrors: ({ errorsManual, errorsAuto, iconSizesInfo, legacyIconImports, guidance, migrationIconImports, shouldUseMigrationPath, context, }: {
139
- errorsManual: ErrorListManual;
140
- errorsAuto: ErrorListAuto;
141
- iconSizesInfo: Record<string, {
142
- small: string[];
143
- usageCount: number;
144
- }>;
145
- legacyIconImports: LegacyIconImportList;
146
- guidance: GuidanceList;
147
- migrationIconImports: MigrationIconImportList;
148
- shouldUseMigrationPath: boolean;
149
- context: Rule.RuleContext;
150
- }) => void;
151
- export {};
@@ -1,2 +0,0 @@
1
- declare const rule: import('eslint').Rule.RuleModule;
2
- export default rule;
@@ -1 +0,0 @@
1
- export declare const upcomingIcons: string[];
@@ -1,16 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- import { type CallExpression, type ExportDefaultDeclaration, type ExportNamedDeclaration, type Identifier, type ImportDeclaration, type VariableDeclaration } from 'eslint-codemod-utils';
3
- type ReturnObject = {
4
- checkImportDeclarations: (node: ImportDeclaration & Rule.NodeParentExtension) => void;
5
- checkVariableDeclarations: (node: VariableDeclaration & Rule.NodeParentExtension) => void;
6
- checkExportDefaultDeclaration: (node: ExportDefaultDeclaration & Rule.NodeParentExtension) => void;
7
- checkExportNamedVariables: (node: ExportNamedDeclaration & Rule.NodeParentExtension) => void;
8
- checkArrayOrMap: (node: Identifier) => void;
9
- checkIconAsProp: (node: Identifier) => void;
10
- checkIconReference: (node: Identifier & Rule.NodeParentExtension) => void;
11
- checkJSXElement: (node: Rule.Node) => void;
12
- checkCallExpression: (node: CallExpression & Rule.NodeParentExtension) => void;
13
- throwErrors: () => void;
14
- };
15
- export declare const createChecks: (context: Rule.RuleContext) => ReturnObject;
16
- export {};
@@ -1,156 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- import { type ImportDeclaration, type JSXAttribute, type Node } from 'eslint-codemod-utils';
3
- import { type IconMigrationSizeGuidance } from '@atlaskit/icon/migration-map';
4
- export type IconMigrationError = Rule.ReportDescriptor;
5
- export type RangeList = {
6
- start: number;
7
- end: number;
8
- }[];
9
- export type ErrorListManual = {
10
- [loc: string]: {
11
- errors: IconMigrationError[];
12
- iconName: string;
13
- importSource: string;
14
- };
15
- };
16
- export type ErrorListAuto = {
17
- [loc: string]: IconMigrationError;
18
- };
19
- export type GuidanceList = {
20
- [loc: string]: string;
21
- };
22
- export type LegacyIconImportList = {
23
- [key: string]: {
24
- packageName: string;
25
- exported: boolean;
26
- importNode: ImportDeclaration;
27
- importSpecifier: string;
28
- };
29
- };
30
- export type MigrationIconImportList = {
31
- [key: string]: {
32
- packageName: string;
33
- exported: boolean;
34
- importNode: ImportDeclaration;
35
- importSpecifier: string;
36
- };
37
- };
38
- declare const sizes: readonly [
39
- "small",
40
- "medium",
41
- "large",
42
- "xlarge"
43
- ];
44
- export type Size = (typeof sizes)[number];
45
- export declare const isSize: (size: any) => size is Size;
46
- /**
47
- * Returns the migration map object for a legacy icon or null if not found
48
- * @param iconPackage The name of the legacy icon package
49
- * @returns The migration map object for the legacy icon or null if not found
50
- */
51
- export declare const getMigrationMapObject: (iconPackage: string) => {
52
- newIcon?: {
53
- name: string;
54
- package: string;
55
- isMigrationUnsafe?: boolean;
56
- shouldForceSmallIcon?: boolean;
57
- };
58
- additionalIcons?: {
59
- name: string;
60
- package: string;
61
- }[];
62
- sizeGuidance: Record<Size, IconMigrationSizeGuidance>;
63
- } | null;
64
- export declare const getUpcomingIcons: (iconPackage: string) => {
65
- sizeGuidance: Record<Size, IconMigrationSizeGuidance>;
66
- } | null;
67
- /**
68
- * Checks if a new icon can be auto-migrated based on guidance from the migration map
69
- */
70
- export declare const canAutoMigrateNewIconBasedOnSize: (guidance?: IconMigrationSizeGuidance) => boolean;
71
- /**
72
- * Creates the written guidance for migrating a legacy icon to a new icon
73
- */
74
- export declare const createGuidance: (props: {
75
- iconPackage: string;
76
- insideNewButton?: boolean;
77
- size?: Size;
78
- shouldUseMigrationPath?: boolean;
79
- shouldForceSmallIcon?: boolean;
80
- }) => string;
81
- /**
82
- * Checks if the color can be migrated
83
- * @param color String representing the color to check
84
- * @returns True if the color can be migrated, false otherwise
85
- */
86
- export declare const canMigrateColor: (color: string) => boolean;
87
- export declare const locToString: (node: Node) => string;
88
- export declare const createCantMigrateReExportError: (node: Node, packageName: string, exportName: string, errors: ErrorListManual) => void;
89
- export declare const createCantMigrateIdentifierMapOrArrayError: (node: Node, packageName: string, exportName: string, errors: ErrorListManual) => void;
90
- export declare const createCantMigrateIdentifierError: (node: Node, packageName: string, exportName: string, errors: ErrorListManual) => void;
91
- export declare const createCantFindSuitableReplacementError: (node: Node, importSource: string, iconName: string, errors: ErrorListManual, sizeIssue?: boolean) => void;
92
- export declare const createCantMigrateFunctionUnknownError: (node: Node, importSource: string, iconName: string, errors: ErrorListManual) => void;
93
- export declare const createCantMigrateColorError: (node: Node, colorValue: string, errors: ErrorListManual, importSource: string, iconName: string) => void;
94
- export declare const createCantMigrateSpreadPropsError: (node: Node, missingProps: string[], errors: ErrorListManual, importSource: string, iconName: string) => void;
95
- export declare const createCantMigrateSizeUnknown: (node: Node, errors: ErrorListManual, importSource: string, iconName: string) => void;
96
- export declare const createAutoMigrationError: ({ node, importSource, iconName, errors, spacing, insideNewButton, shouldForceSmallIcon, }: {
97
- node: Node;
98
- importSource: string;
99
- iconName: string;
100
- errors: ErrorListAuto;
101
- spacing?: string;
102
- insideNewButton?: boolean;
103
- shouldForceSmallIcon?: boolean;
104
- }) => void;
105
- export declare const createHelpers: (ctx: Rule.RuleContext) => {
106
- /**
107
- * Extracts the primaryColor value from a JSXAttribute
108
- */
109
- getPrimaryColor(attr: JSXAttribute): string | null;
110
- getTokenCallValue: (value: any) => string | undefined;
111
- getConfigFlag: (key: string, defaultValue: boolean) => boolean;
112
- };
113
- export declare const addToListOfRanges: (node: Node, sortedListOfRangesForErrors: RangeList) => void;
114
- /**
115
- *
116
- * @param node Icon JSXelement
117
- * @param newButtonImports list of new button import specifiers
118
- * @returns if Icon is inside a new button
119
- */
120
- export declare const isInsideNewButton: (node: Rule.Node, newButtonImports: Set<string>) => boolean;
121
- /**
122
- *
123
- * @param node Icon JSXelement
124
- * @param newButtonImports list of legacy button import specifiers
125
- * @returns if Icon is inside a legacy button
126
- */
127
- export declare const isInsideLegacyButton: (node: Rule.Node, legacyButtonImports: Set<string>) => boolean;
128
- /**
129
- *
130
- * @param node Icon JSXelement
131
- * @param newButtonImports list of legacy button import specifiers
132
- * @returns if Icon is inside a legacy button
133
- */
134
- export declare const isInsideIconOnlyLegacyButton: (node: Rule.Node, legacyButtonImports: Set<string>) => boolean;
135
- export declare const getComponentName: (name: string) => string;
136
- export declare const throwManualErrors: ({ errorsManual, errorRanges, guidance, context, isQuietMode, }: {
137
- errorsManual: ErrorListManual;
138
- errorRanges: RangeList;
139
- guidance: GuidanceList;
140
- context: Rule.RuleContext;
141
- isQuietMode: boolean;
142
- }) => void;
143
- export declare const throwAutoErrors: ({ errorsManual, errorsAuto, iconSizesInfo, legacyIconImports, guidance, migrationIconImports, shouldUseMigrationPath, context, }: {
144
- errorsManual: ErrorListManual;
145
- errorsAuto: ErrorListAuto;
146
- iconSizesInfo: Record<string, {
147
- small: string[];
148
- usageCount: number;
149
- }>;
150
- legacyIconImports: LegacyIconImportList;
151
- guidance: GuidanceList;
152
- migrationIconImports: MigrationIconImportList;
153
- shouldUseMigrationPath: boolean;
154
- context: Rule.RuleContext;
155
- }) => void;
156
- export {};
@@ -1,2 +0,0 @@
1
- declare const rule: import('eslint').Rule.RuleModule;
2
- export default rule;
@@ -1 +0,0 @@
1
- export declare const upcomingIcons: string[];