@atlaskit/eslint-plugin-design-system 11.0.0 → 11.0.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 +9 -0
- package/dist/cjs/rules/no-legacy-icons/checks.js +2 -2
- package/dist/cjs/rules/no-legacy-icons/index.js +7 -7
- package/dist/es2019/rules/no-legacy-icons/checks.js +2 -2
- package/dist/es2019/rules/no-legacy-icons/index.js +7 -7
- package/dist/esm/rules/no-legacy-icons/checks.js +2 -2
- package/dist/esm/rules/no-legacy-icons/index.js +7 -7
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 11.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#169436](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/169436)
|
|
8
|
+
[`8c910a5de1c93`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8c910a5de1c93) -
|
|
9
|
+
Updates `no-legacy-icon` to no longer error on references to @atlaskit/icon-object
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 11.0.0
|
|
4
13
|
|
|
5
14
|
### Major Changes
|
|
@@ -39,7 +39,7 @@ var createChecks = exports.createChecks = function createChecks(context) {
|
|
|
39
39
|
var moduleSource = node.source.value;
|
|
40
40
|
|
|
41
41
|
// Find the imports for legacy icons
|
|
42
|
-
if (moduleSource && typeof moduleSource === 'string' && ['@atlaskit/icon/glyph/'
|
|
42
|
+
if (moduleSource && typeof moduleSource === 'string' && ['@atlaskit/icon/glyph/'].find(function (val) {
|
|
43
43
|
return moduleSource.startsWith(val);
|
|
44
44
|
}) && node.specifiers.length > 0) {
|
|
45
45
|
var _iterator = _createForOfIteratorHelper(node.specifiers),
|
|
@@ -181,7 +181,7 @@ var createChecks = exports.createChecks = function createChecks(context) {
|
|
|
181
181
|
// Case: export {default as AddIcon} from '@atlaskit/icon/glyph/add';
|
|
182
182
|
if (node.source && (0, _eslintCodemodUtils.isNodeOfType)(node.source, 'Literal') && Object.keys(node.source).includes('value')) {
|
|
183
183
|
var moduleSource = node.source.value;
|
|
184
|
-
if (typeof moduleSource === 'string' && ['@atlaskit/icon/glyph/'
|
|
184
|
+
if (typeof moduleSource === 'string' && ['@atlaskit/icon/glyph/'].find(function (val) {
|
|
185
185
|
return moduleSource.startsWith(val);
|
|
186
186
|
}) && node.specifiers.length) {
|
|
187
187
|
var _iterator5 = _createForOfIteratorHelper(node.specifiers),
|
|
@@ -41,13 +41,13 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
41
41
|
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.'",
|
|
42
42
|
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.",
|
|
43
43
|
cantFindSuitableReplacement: "No suitable replacement found for '{{iconName}}' from '{{importSource}}'{{sizeGuidance}}. Please manually migrate this icon.",
|
|
44
|
-
cantMigrateReExport: "'{{exportName}}' is a re-export of icon from '{{packageName}}' and cannot be automatically migrated. Please
|
|
45
|
-
cantMigrateColor: "
|
|
46
|
-
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}}' ",
|
|
47
|
-
cantMigrateSizeUnknown: "This usage of Icon sets the size via a variable or function that can't be
|
|
48
|
-
cantMigrateFunctionUnknown: "'{{iconName}}' from
|
|
49
|
-
cantMigrateIdentifierMapOrArray: "This icon is passed to other components via a map or array,
|
|
50
|
-
cantMigrateIdentifier: "This
|
|
44
|
+
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.",
|
|
45
|
+
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.",
|
|
46
|
+
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}}' ",
|
|
47
|
+
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.",
|
|
48
|
+
cantMigrateFunctionUnknown: "Icon '{{iconName}}', from entrypoint '{{importSource}}', is passed into a function/component and can't be migrated automatically. Please manually migrate this icon.",
|
|
49
|
+
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.",
|
|
50
|
+
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."
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
create: function create(context) {
|
|
@@ -31,7 +31,7 @@ export const createChecks = context => {
|
|
|
31
31
|
const moduleSource = node.source.value;
|
|
32
32
|
|
|
33
33
|
// Find the imports for legacy icons
|
|
34
|
-
if (moduleSource && typeof moduleSource === 'string' && ['@atlaskit/icon/glyph/'
|
|
34
|
+
if (moduleSource && typeof moduleSource === 'string' && ['@atlaskit/icon/glyph/'].find(val => moduleSource.startsWith(val)) && node.specifiers.length > 0) {
|
|
35
35
|
for (const spec of node.specifiers) {
|
|
36
36
|
if (spec.local.name) {
|
|
37
37
|
legacyIconImports[spec.local.name] = {
|
|
@@ -135,7 +135,7 @@ export const createChecks = context => {
|
|
|
135
135
|
// Case: export {default as AddIcon} from '@atlaskit/icon/glyph/add';
|
|
136
136
|
if (node.source && isNodeOfType(node.source, 'Literal') && Object.keys(node.source).includes('value')) {
|
|
137
137
|
const moduleSource = node.source.value;
|
|
138
|
-
if (typeof moduleSource === 'string' && ['@atlaskit/icon/glyph/'
|
|
138
|
+
if (typeof moduleSource === 'string' && ['@atlaskit/icon/glyph/'].find(val => moduleSource.startsWith(val)) && node.specifiers.length) {
|
|
139
139
|
for (const spec of node.specifiers) {
|
|
140
140
|
createCantMigrateReExportError(spec, moduleSource, spec.exported.name, errorsManual);
|
|
141
141
|
addToListOfRanges(spec, errorRanges);
|
|
@@ -35,13 +35,13 @@ const rule = createLintRule({
|
|
|
35
35
|
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.'`,
|
|
36
36
|
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.`,
|
|
37
37
|
cantFindSuitableReplacement: `No suitable replacement found for '{{iconName}}' from '{{importSource}}'{{sizeGuidance}}. Please manually migrate this icon.`,
|
|
38
|
-
cantMigrateReExport: `'{{exportName}}' is a re-export of icon from '{{packageName}}' and cannot be automatically migrated. Please
|
|
39
|
-
cantMigrateColor: `
|
|
40
|
-
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}}' `,
|
|
41
|
-
cantMigrateSizeUnknown: `This usage of Icon sets the size via a variable or function that can't be
|
|
42
|
-
cantMigrateFunctionUnknown: `'{{iconName}}' from
|
|
43
|
-
cantMigrateIdentifierMapOrArray: `This icon is passed to other components via a map or array,
|
|
44
|
-
cantMigrateIdentifier: `This
|
|
38
|
+
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.`,
|
|
39
|
+
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.`,
|
|
40
|
+
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}}' `,
|
|
41
|
+
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.`,
|
|
42
|
+
cantMigrateFunctionUnknown: `Icon '{{iconName}}', from entrypoint '{{importSource}}', is passed into a function/component and can't be migrated automatically. Please manually migrate this icon.`,
|
|
43
|
+
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.`,
|
|
44
|
+
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.`
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
create(context) {
|
|
@@ -33,7 +33,7 @@ export var createChecks = function createChecks(context) {
|
|
|
33
33
|
var moduleSource = node.source.value;
|
|
34
34
|
|
|
35
35
|
// Find the imports for legacy icons
|
|
36
|
-
if (moduleSource && typeof moduleSource === 'string' && ['@atlaskit/icon/glyph/'
|
|
36
|
+
if (moduleSource && typeof moduleSource === 'string' && ['@atlaskit/icon/glyph/'].find(function (val) {
|
|
37
37
|
return moduleSource.startsWith(val);
|
|
38
38
|
}) && node.specifiers.length > 0) {
|
|
39
39
|
var _iterator = _createForOfIteratorHelper(node.specifiers),
|
|
@@ -175,7 +175,7 @@ export var createChecks = function createChecks(context) {
|
|
|
175
175
|
// Case: export {default as AddIcon} from '@atlaskit/icon/glyph/add';
|
|
176
176
|
if (node.source && isNodeOfType(node.source, 'Literal') && Object.keys(node.source).includes('value')) {
|
|
177
177
|
var moduleSource = node.source.value;
|
|
178
|
-
if (typeof moduleSource === 'string' && ['@atlaskit/icon/glyph/'
|
|
178
|
+
if (typeof moduleSource === 'string' && ['@atlaskit/icon/glyph/'].find(function (val) {
|
|
179
179
|
return moduleSource.startsWith(val);
|
|
180
180
|
}) && node.specifiers.length) {
|
|
181
181
|
var _iterator5 = _createForOfIteratorHelper(node.specifiers),
|
|
@@ -35,13 +35,13 @@ var rule = createLintRule({
|
|
|
35
35
|
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.'",
|
|
36
36
|
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.",
|
|
37
37
|
cantFindSuitableReplacement: "No suitable replacement found for '{{iconName}}' from '{{importSource}}'{{sizeGuidance}}. Please manually migrate this icon.",
|
|
38
|
-
cantMigrateReExport: "'{{exportName}}' is a re-export of icon from '{{packageName}}' and cannot be automatically migrated. Please
|
|
39
|
-
cantMigrateColor: "
|
|
40
|
-
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}}' ",
|
|
41
|
-
cantMigrateSizeUnknown: "This usage of Icon sets the size via a variable or function that can't be
|
|
42
|
-
cantMigrateFunctionUnknown: "'{{iconName}}' from
|
|
43
|
-
cantMigrateIdentifierMapOrArray: "This icon is passed to other components via a map or array,
|
|
44
|
-
cantMigrateIdentifier: "This
|
|
38
|
+
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.",
|
|
39
|
+
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.",
|
|
40
|
+
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}}' ",
|
|
41
|
+
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.",
|
|
42
|
+
cantMigrateFunctionUnknown: "Icon '{{iconName}}', from entrypoint '{{importSource}}', is passed into a function/component and can't be migrated automatically. Please manually migrate this icon.",
|
|
43
|
+
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.",
|
|
44
|
+
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."
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
create: function create(context) {
|
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": "11.0.
|
|
4
|
+
"version": "11.0.1",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"publishConfig": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@atlaskit/eslint-utils": "^1.7.0",
|
|
47
|
-
"@atlaskit/icon": "^22.
|
|
47
|
+
"@atlaskit/icon": "^22.28.0",
|
|
48
48
|
"@atlaskit/icon-lab": "^1.2.0",
|
|
49
49
|
"@atlaskit/tokens": "*",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@af/formatting": "*",
|
|
61
|
-
"@atlaskit/ds-lib": "^3.
|
|
61
|
+
"@atlaskit/ds-lib": "^3.3.0",
|
|
62
62
|
"@atlaskit/theme": "^14.0.0",
|
|
63
63
|
"@atlassian/codegen": "*",
|
|
64
64
|
"@atlassian/eslint-utils": "^0.5.0",
|