@atlaskit/eslint-plugin-design-system 10.18.0 → 10.18.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 +15 -0
- package/README.md +1 -1
- package/dist/cjs/rules/ensure-icon-color/index.js +1 -1
- package/dist/cjs/rules/no-legacy-icons/checks.js +29 -137
- package/dist/cjs/rules/no-legacy-icons/helpers.js +247 -16
- package/dist/cjs/rules/no-legacy-icons/index.js +1 -0
- package/dist/es2019/rules/ensure-icon-color/index.js +1 -1
- package/dist/es2019/rules/no-legacy-icons/checks.js +30 -108
- package/dist/es2019/rules/no-legacy-icons/helpers.js +200 -15
- package/dist/es2019/rules/no-legacy-icons/index.js +1 -0
- package/dist/esm/rules/ensure-icon-color/index.js +1 -1
- package/dist/esm/rules/no-legacy-icons/checks.js +30 -137
- package/dist/esm/rules/no-legacy-icons/helpers.js +246 -15
- package/dist/esm/rules/no-legacy-icons/index.js +1 -0
- package/dist/types/rules/no-legacy-icons/helpers.d.ts +31 -60
- package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +31 -60
- package/package.json +3 -3
|
@@ -19,6 +19,22 @@ export type ErrorListAuto = {
|
|
|
19
19
|
export type GuidanceList = {
|
|
20
20
|
[loc: string]: string;
|
|
21
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
|
+
};
|
|
22
38
|
declare const sizes: readonly ["small", "medium", "large", "xlarge"];
|
|
23
39
|
export type Size = (typeof sizes)[number];
|
|
24
40
|
export declare const isSize: (size: any) => size is "small" | "medium" | "large" | "xlarge";
|
|
@@ -47,15 +63,6 @@ export declare const getUpcomingIcons: (iconPackage: string) => {
|
|
|
47
63
|
* Checks if a new icon can be auto-migrated based on guidance from the migration map
|
|
48
64
|
*/
|
|
49
65
|
export declare const canAutoMigrateNewIconBasedOnSize: (guidance?: string) => boolean;
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
* @param iconPackage string
|
|
53
|
-
* @returns object of new icon name and import path
|
|
54
|
-
*/
|
|
55
|
-
export declare const getNewIconNameAndImportPath: (iconPackage: string, shouldUseMigrationPath?: boolean) => {
|
|
56
|
-
iconName?: string;
|
|
57
|
-
importPath?: string;
|
|
58
|
-
};
|
|
59
66
|
/**
|
|
60
67
|
* Creates the written guidance for migrating a legacy icon to a new icon
|
|
61
68
|
*/
|
|
@@ -88,7 +95,6 @@ export declare const createAutoMigrationError: ({ node, importSource, iconName,
|
|
|
88
95
|
shouldAddSpaciousSpacing?: boolean | undefined;
|
|
89
96
|
insideNewButton?: boolean | undefined;
|
|
90
97
|
}) => void;
|
|
91
|
-
export declare const getLiteralStringValue: (value: any) => string | undefined;
|
|
92
98
|
export declare const createHelpers: (context: Rule.RuleContext) => {
|
|
93
99
|
/**
|
|
94
100
|
* Extracts the primaryColor value from a JSXAttribute
|
|
@@ -98,7 +104,6 @@ export declare const createHelpers: (context: Rule.RuleContext) => {
|
|
|
98
104
|
getConfigFlag: (key: string, defaultValue: boolean) => boolean;
|
|
99
105
|
};
|
|
100
106
|
export declare const addToListOfRanges: (node: Node, sortedListOfRangesForErrors: RangeList) => void;
|
|
101
|
-
export declare const isInRangeList: (node: Node, sortedListOfRangesForErrors: RangeList) => boolean;
|
|
102
107
|
/**
|
|
103
108
|
*
|
|
104
109
|
* @param node Icon JSXelement
|
|
@@ -113,54 +118,20 @@ export declare const isInsideNewButton: (node: Rule.Node, newButtonImports: Set<
|
|
|
113
118
|
* @returns if Icon is inside a legacy button
|
|
114
119
|
*/
|
|
115
120
|
export declare const isInsideLegacyButton: (node: Rule.Node, legacyButtonImports: Set<string>) => boolean;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
importSource: string;
|
|
130
|
-
spacing: string;
|
|
131
|
-
};
|
|
132
|
-
legacyImportNode?: ImportDeclaration | undefined;
|
|
133
|
-
shouldUseMigrationPath: boolean;
|
|
134
|
-
migrationImportNode?: ImportDeclaration | undefined;
|
|
135
|
-
}) => Rule.Fix[];
|
|
136
|
-
/**
|
|
137
|
-
* Creates a list of fixers to update the icon props
|
|
138
|
-
* @param node The Icon element to migrate
|
|
139
|
-
* @param metadata Metadata including the import source and spacing
|
|
140
|
-
* @param fixer The original fix function
|
|
141
|
-
* @param legacyImportNode The import declaration node to replace
|
|
142
|
-
* @param shouldUseMigrationPath The eslint rule config, whether to use migration entrypoint or not
|
|
143
|
-
* @param migrationImportNode The migration import declaration node to replace, only present if shouldUseMigrationPath is false
|
|
144
|
-
* @returns A list of fixers to migrate the icon
|
|
145
|
-
*/
|
|
146
|
-
export declare const createPropFixes: ({ node, fixer, legacyImportNode, metadata, shouldUseMigrationPath, migrationImportNode, }: {
|
|
147
|
-
node: Node;
|
|
148
|
-
fixer: Rule.RuleFixer;
|
|
149
|
-
metadata: {
|
|
150
|
-
importSource: string;
|
|
151
|
-
spacing: string;
|
|
152
|
-
insideNewButton: string;
|
|
153
|
-
};
|
|
154
|
-
legacyImportNode?: ImportDeclaration | undefined;
|
|
121
|
+
export declare const throwManualErrors: ({ errorsManual, errorRanges, guidance, context, isQuietMode, }: {
|
|
122
|
+
errorsManual: ErrorListManual;
|
|
123
|
+
errorRanges: RangeList;
|
|
124
|
+
guidance: GuidanceList;
|
|
125
|
+
context: Rule.RuleContext;
|
|
126
|
+
isQuietMode: boolean;
|
|
127
|
+
}) => void;
|
|
128
|
+
export declare const throwAutoErrors: ({ errorsManual, errorsAuto, legacyIconImports, guidance, migrationIconImports, shouldUseMigrationPath, context, }: {
|
|
129
|
+
errorsManual: ErrorListManual;
|
|
130
|
+
errorsAuto: ErrorListAuto;
|
|
131
|
+
legacyIconImports: LegacyIconImportList;
|
|
132
|
+
guidance: GuidanceList;
|
|
133
|
+
migrationIconImports: MigrationIconImportList;
|
|
155
134
|
shouldUseMigrationPath: boolean;
|
|
156
|
-
|
|
157
|
-
}) =>
|
|
158
|
-
/**
|
|
159
|
-
* Check if the new icon exists in the migration map
|
|
160
|
-
*/
|
|
161
|
-
export declare const checkIfNewIconExist: (error: {
|
|
162
|
-
data?: {
|
|
163
|
-
importSource?: string;
|
|
164
|
-
};
|
|
165
|
-
}) => boolean;
|
|
135
|
+
context: Rule.RuleContext;
|
|
136
|
+
}) => void;
|
|
166
137
|
export {};
|
|
@@ -19,6 +19,22 @@ export type ErrorListAuto = {
|
|
|
19
19
|
export type GuidanceList = {
|
|
20
20
|
[loc: string]: string;
|
|
21
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
|
+
};
|
|
22
38
|
declare const sizes: readonly [
|
|
23
39
|
"small",
|
|
24
40
|
"medium",
|
|
@@ -52,15 +68,6 @@ export declare const getUpcomingIcons: (iconPackage: string) => {
|
|
|
52
68
|
* Checks if a new icon can be auto-migrated based on guidance from the migration map
|
|
53
69
|
*/
|
|
54
70
|
export declare const canAutoMigrateNewIconBasedOnSize: (guidance?: string) => boolean;
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
* @param iconPackage string
|
|
58
|
-
* @returns object of new icon name and import path
|
|
59
|
-
*/
|
|
60
|
-
export declare const getNewIconNameAndImportPath: (iconPackage: string, shouldUseMigrationPath?: boolean) => {
|
|
61
|
-
iconName?: string;
|
|
62
|
-
importPath?: string;
|
|
63
|
-
};
|
|
64
71
|
/**
|
|
65
72
|
* Creates the written guidance for migrating a legacy icon to a new icon
|
|
66
73
|
*/
|
|
@@ -93,7 +100,6 @@ export declare const createAutoMigrationError: ({ node, importSource, iconName,
|
|
|
93
100
|
shouldAddSpaciousSpacing?: boolean | undefined;
|
|
94
101
|
insideNewButton?: boolean | undefined;
|
|
95
102
|
}) => void;
|
|
96
|
-
export declare const getLiteralStringValue: (value: any) => string | undefined;
|
|
97
103
|
export declare const createHelpers: (context: Rule.RuleContext) => {
|
|
98
104
|
/**
|
|
99
105
|
* Extracts the primaryColor value from a JSXAttribute
|
|
@@ -103,7 +109,6 @@ export declare const createHelpers: (context: Rule.RuleContext) => {
|
|
|
103
109
|
getConfigFlag: (key: string, defaultValue: boolean) => boolean;
|
|
104
110
|
};
|
|
105
111
|
export declare const addToListOfRanges: (node: Node, sortedListOfRangesForErrors: RangeList) => void;
|
|
106
|
-
export declare const isInRangeList: (node: Node, sortedListOfRangesForErrors: RangeList) => boolean;
|
|
107
112
|
/**
|
|
108
113
|
*
|
|
109
114
|
* @param node Icon JSXelement
|
|
@@ -118,54 +123,20 @@ export declare const isInsideNewButton: (node: Rule.Node, newButtonImports: Set<
|
|
|
118
123
|
* @returns if Icon is inside a legacy button
|
|
119
124
|
*/
|
|
120
125
|
export declare const isInsideLegacyButton: (node: Rule.Node, legacyButtonImports: Set<string>) => boolean;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
importSource: string;
|
|
135
|
-
spacing: string;
|
|
136
|
-
};
|
|
137
|
-
legacyImportNode?: ImportDeclaration | undefined;
|
|
138
|
-
shouldUseMigrationPath: boolean;
|
|
139
|
-
migrationImportNode?: ImportDeclaration | undefined;
|
|
140
|
-
}) => Rule.Fix[];
|
|
141
|
-
/**
|
|
142
|
-
* Creates a list of fixers to update the icon props
|
|
143
|
-
* @param node The Icon element to migrate
|
|
144
|
-
* @param metadata Metadata including the import source and spacing
|
|
145
|
-
* @param fixer The original fix function
|
|
146
|
-
* @param legacyImportNode The import declaration node to replace
|
|
147
|
-
* @param shouldUseMigrationPath The eslint rule config, whether to use migration entrypoint or not
|
|
148
|
-
* @param migrationImportNode The migration import declaration node to replace, only present if shouldUseMigrationPath is false
|
|
149
|
-
* @returns A list of fixers to migrate the icon
|
|
150
|
-
*/
|
|
151
|
-
export declare const createPropFixes: ({ node, fixer, legacyImportNode, metadata, shouldUseMigrationPath, migrationImportNode, }: {
|
|
152
|
-
node: Node;
|
|
153
|
-
fixer: Rule.RuleFixer;
|
|
154
|
-
metadata: {
|
|
155
|
-
importSource: string;
|
|
156
|
-
spacing: string;
|
|
157
|
-
insideNewButton: string;
|
|
158
|
-
};
|
|
159
|
-
legacyImportNode?: ImportDeclaration | undefined;
|
|
126
|
+
export declare const throwManualErrors: ({ errorsManual, errorRanges, guidance, context, isQuietMode, }: {
|
|
127
|
+
errorsManual: ErrorListManual;
|
|
128
|
+
errorRanges: RangeList;
|
|
129
|
+
guidance: GuidanceList;
|
|
130
|
+
context: Rule.RuleContext;
|
|
131
|
+
isQuietMode: boolean;
|
|
132
|
+
}) => void;
|
|
133
|
+
export declare const throwAutoErrors: ({ errorsManual, errorsAuto, legacyIconImports, guidance, migrationIconImports, shouldUseMigrationPath, context, }: {
|
|
134
|
+
errorsManual: ErrorListManual;
|
|
135
|
+
errorsAuto: ErrorListAuto;
|
|
136
|
+
legacyIconImports: LegacyIconImportList;
|
|
137
|
+
guidance: GuidanceList;
|
|
138
|
+
migrationIconImports: MigrationIconImportList;
|
|
160
139
|
shouldUseMigrationPath: boolean;
|
|
161
|
-
|
|
162
|
-
}) =>
|
|
163
|
-
/**
|
|
164
|
-
* Check if the new icon exists in the migration map
|
|
165
|
-
*/
|
|
166
|
-
export declare const checkIfNewIconExist: (error: {
|
|
167
|
-
data?: {
|
|
168
|
-
importSource?: string;
|
|
169
|
-
};
|
|
170
|
-
}) => boolean;
|
|
140
|
+
context: Rule.RuleContext;
|
|
141
|
+
}) => void;
|
|
171
142
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/eslint-plugin-design-system",
|
|
3
3
|
"description": "The essential plugin for use with the Atlassian Design System.",
|
|
4
|
-
"version": "10.18.
|
|
4
|
+
"version": "10.18.2",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"publishConfig": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@atlaskit/eslint-utils": "^1.7.0",
|
|
44
|
-
"@atlaskit/icon": "^22.
|
|
44
|
+
"@atlaskit/icon": "^22.16.0",
|
|
45
45
|
"@atlaskit/tokens": "*",
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|
|
47
47
|
"@typescript-eslint/utils": "^5.48.1",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@types/eslint": "^8.56.6",
|
|
65
65
|
"@types/esquery": "^1.5.3",
|
|
66
66
|
"@types/estraverse": "^5.1.7",
|
|
67
|
-
"eslint": "^8.
|
|
67
|
+
"eslint": "^8.57.0",
|
|
68
68
|
"jscodeshift": "^0.13.0",
|
|
69
69
|
"outdent": "^0.5.0",
|
|
70
70
|
"react": "^16.8.0",
|