@atlaskit/eslint-plugin-design-system 13.21.3 → 13.22.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.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/rules/no-deprecated-imports/handlers/icon.js +13 -2
- package/dist/cjs/rules/no-deprecated-imports/index.js +5 -1
- package/dist/es2019/rules/no-deprecated-imports/handlers/icon.js +13 -2
- package/dist/es2019/rules/no-deprecated-imports/index.js +5 -1
- package/dist/esm/rules/no-deprecated-imports/handlers/icon.js +13 -2
- package/dist/esm/rules/no-deprecated-imports/index.js +5 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 13.22.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`4df3a43323a47`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4df3a43323a47) -
|
|
8
|
+
Added `turnOffAutoFixer` configuration option to the `no-deprecated-imports` rule, allowing users
|
|
9
|
+
to disable automatic code fixes while still reporting deprecated import violations.
|
|
10
|
+
|
|
3
11
|
## 13.21.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -24,6 +24,12 @@ var getDeprecationIconHandler = exports.getDeprecationIconHandler = function get
|
|
|
24
24
|
var identifiers = new Map();
|
|
25
25
|
var importErrors = {};
|
|
26
26
|
var exportErrors = {};
|
|
27
|
+
var getConfigFlag = function getConfigFlag(key, defaultValue) {
|
|
28
|
+
if (context.options && context.options.length > 0 && context.options[0] && context.options[0].hasOwnProperty(key)) {
|
|
29
|
+
return context.options[0][key] === !defaultValue ? !defaultValue : defaultValue;
|
|
30
|
+
}
|
|
31
|
+
return defaultValue;
|
|
32
|
+
};
|
|
27
33
|
var getIconComponentName = function getIconComponentName(name) {
|
|
28
34
|
return name.split(/\W/).map(function (part) {
|
|
29
35
|
return "".concat(part[0].toUpperCase()).concat(part.slice(1));
|
|
@@ -63,6 +69,7 @@ var getDeprecationIconHandler = exports.getDeprecationIconHandler = function get
|
|
|
63
69
|
}
|
|
64
70
|
};
|
|
65
71
|
var throwErrors = function throwErrors() {
|
|
72
|
+
var shouldTurnOffAutoFixer = getConfigFlag('turnOffAutoFixer', false);
|
|
66
73
|
for (var _i = 0, _Object$entries = Object.entries(importErrors); _i < _Object$entries.length; _i++) {
|
|
67
74
|
var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
|
|
68
75
|
importSource = _Object$entries$_i[0],
|
|
@@ -83,7 +90,9 @@ var getDeprecationIconHandler = exports.getDeprecationIconHandler = function get
|
|
|
83
90
|
var replacement = metadata === null || metadata === void 0 || (_metadata$deprecatedI = metadata[deprecatedIconName]) === null || _metadata$deprecatedI === void 0 ? void 0 : _metadata$deprecatedI.replacement;
|
|
84
91
|
if (replacement && ((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.unfixable) === 'false') {
|
|
85
92
|
var newIconName = getIconComponentName(replacement.name);
|
|
86
|
-
|
|
93
|
+
if (!shouldTurnOffAutoFixer) {
|
|
94
|
+
addAutoFix(error, importSource, "".concat(replacement.location, "/").concat(replacement.type, "/migration/").concat(replacement.name, "--").concat(legacyIconName), newIconName);
|
|
95
|
+
}
|
|
87
96
|
}
|
|
88
97
|
} else {
|
|
89
98
|
var _metadata2;
|
|
@@ -101,7 +110,9 @@ var getDeprecationIconHandler = exports.getDeprecationIconHandler = function get
|
|
|
101
110
|
var _replacement = (_metadata2 = _metadata) === null || _metadata2 === void 0 || (_metadata2 = _metadata2[_name]) === null || _metadata2 === void 0 ? void 0 : _metadata2.replacement;
|
|
102
111
|
if (_replacement) {
|
|
103
112
|
var _newIconName = getIconComponentName(_replacement.name);
|
|
104
|
-
|
|
113
|
+
if (!shouldTurnOffAutoFixer) {
|
|
114
|
+
addAutoFix(error, importSource, "".concat(_replacement.location, "/").concat(_replacement.type, "/").concat(_replacement.name), _newIconName);
|
|
115
|
+
}
|
|
105
116
|
}
|
|
106
117
|
}
|
|
107
118
|
context.report(error);
|
|
@@ -53,6 +53,9 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
53
53
|
schema: [{
|
|
54
54
|
type: 'object',
|
|
55
55
|
properties: {
|
|
56
|
+
turnOffAutoFixer: {
|
|
57
|
+
type: 'boolean'
|
|
58
|
+
},
|
|
56
59
|
deprecatedConfig: {
|
|
57
60
|
type: 'object',
|
|
58
61
|
properties: {
|
|
@@ -81,7 +84,8 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
|
-
}
|
|
87
|
+
},
|
|
88
|
+
additionalProperties: false
|
|
85
89
|
}]
|
|
86
90
|
},
|
|
87
91
|
create: function create(context) {
|
|
@@ -13,6 +13,12 @@ export const getDeprecationIconHandler = context => {
|
|
|
13
13
|
const identifiers = new Map();
|
|
14
14
|
const importErrors = {};
|
|
15
15
|
const exportErrors = {};
|
|
16
|
+
const getConfigFlag = (key, defaultValue) => {
|
|
17
|
+
if (context.options && context.options.length > 0 && context.options[0] && context.options[0].hasOwnProperty(key)) {
|
|
18
|
+
return context.options[0][key] === !defaultValue ? !defaultValue : defaultValue;
|
|
19
|
+
}
|
|
20
|
+
return defaultValue;
|
|
21
|
+
};
|
|
16
22
|
const getIconComponentName = name => {
|
|
17
23
|
return name.split(/\W/).map(part => `${part[0].toUpperCase()}${part.slice(1)}`).join('').concat('Icon');
|
|
18
24
|
};
|
|
@@ -52,6 +58,7 @@ export const getDeprecationIconHandler = context => {
|
|
|
52
58
|
}
|
|
53
59
|
};
|
|
54
60
|
const throwErrors = () => {
|
|
61
|
+
const shouldTurnOffAutoFixer = getConfigFlag('turnOffAutoFixer', false);
|
|
55
62
|
for (const [importSource, error] of Object.entries(importErrors)) {
|
|
56
63
|
if (importSource.includes('/migration/')) {
|
|
57
64
|
var _metadata$deprecatedI, _error$data;
|
|
@@ -61,7 +68,9 @@ export const getDeprecationIconHandler = context => {
|
|
|
61
68
|
const replacement = metadata === null || metadata === void 0 ? void 0 : (_metadata$deprecatedI = metadata[deprecatedIconName]) === null || _metadata$deprecatedI === void 0 ? void 0 : _metadata$deprecatedI.replacement;
|
|
62
69
|
if (replacement && ((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.unfixable) === 'false') {
|
|
63
70
|
const newIconName = getIconComponentName(replacement.name);
|
|
64
|
-
|
|
71
|
+
if (!shouldTurnOffAutoFixer) {
|
|
72
|
+
addAutoFix(error, importSource, `${replacement.location}/${replacement.type}/migration/${replacement.name}--${legacyIconName}`, newIconName);
|
|
73
|
+
}
|
|
65
74
|
}
|
|
66
75
|
} else {
|
|
67
76
|
var _metadata, _metadata$name;
|
|
@@ -75,7 +84,9 @@ export const getDeprecationIconHandler = context => {
|
|
|
75
84
|
const replacement = (_metadata = metadata) === null || _metadata === void 0 ? void 0 : (_metadata$name = _metadata[name]) === null || _metadata$name === void 0 ? void 0 : _metadata$name.replacement;
|
|
76
85
|
if (replacement) {
|
|
77
86
|
const newIconName = getIconComponentName(replacement.name);
|
|
78
|
-
|
|
87
|
+
if (!shouldTurnOffAutoFixer) {
|
|
88
|
+
addAutoFix(error, importSource, `${replacement.location}/${replacement.type}/${replacement.name}`, newIconName);
|
|
89
|
+
}
|
|
79
90
|
}
|
|
80
91
|
}
|
|
81
92
|
context.report(error);
|
|
@@ -47,6 +47,9 @@ const rule = createLintRule({
|
|
|
47
47
|
schema: [{
|
|
48
48
|
type: 'object',
|
|
49
49
|
properties: {
|
|
50
|
+
turnOffAutoFixer: {
|
|
51
|
+
type: 'boolean'
|
|
52
|
+
},
|
|
50
53
|
deprecatedConfig: {
|
|
51
54
|
type: 'object',
|
|
52
55
|
properties: {
|
|
@@ -75,7 +78,8 @@ const rule = createLintRule({
|
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
|
-
}
|
|
81
|
+
},
|
|
82
|
+
additionalProperties: false
|
|
79
83
|
}]
|
|
80
84
|
},
|
|
81
85
|
create(context) {
|
|
@@ -17,6 +17,12 @@ export var getDeprecationIconHandler = function getDeprecationIconHandler(contex
|
|
|
17
17
|
var identifiers = new Map();
|
|
18
18
|
var importErrors = {};
|
|
19
19
|
var exportErrors = {};
|
|
20
|
+
var getConfigFlag = function getConfigFlag(key, defaultValue) {
|
|
21
|
+
if (context.options && context.options.length > 0 && context.options[0] && context.options[0].hasOwnProperty(key)) {
|
|
22
|
+
return context.options[0][key] === !defaultValue ? !defaultValue : defaultValue;
|
|
23
|
+
}
|
|
24
|
+
return defaultValue;
|
|
25
|
+
};
|
|
20
26
|
var getIconComponentName = function getIconComponentName(name) {
|
|
21
27
|
return name.split(/\W/).map(function (part) {
|
|
22
28
|
return "".concat(part[0].toUpperCase()).concat(part.slice(1));
|
|
@@ -56,6 +62,7 @@ export var getDeprecationIconHandler = function getDeprecationIconHandler(contex
|
|
|
56
62
|
}
|
|
57
63
|
};
|
|
58
64
|
var throwErrors = function throwErrors() {
|
|
65
|
+
var shouldTurnOffAutoFixer = getConfigFlag('turnOffAutoFixer', false);
|
|
59
66
|
for (var _i = 0, _Object$entries = Object.entries(importErrors); _i < _Object$entries.length; _i++) {
|
|
60
67
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
61
68
|
importSource = _Object$entries$_i[0],
|
|
@@ -76,7 +83,9 @@ export var getDeprecationIconHandler = function getDeprecationIconHandler(contex
|
|
|
76
83
|
var replacement = metadata === null || metadata === void 0 || (_metadata$deprecatedI = metadata[deprecatedIconName]) === null || _metadata$deprecatedI === void 0 ? void 0 : _metadata$deprecatedI.replacement;
|
|
77
84
|
if (replacement && ((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.unfixable) === 'false') {
|
|
78
85
|
var newIconName = getIconComponentName(replacement.name);
|
|
79
|
-
|
|
86
|
+
if (!shouldTurnOffAutoFixer) {
|
|
87
|
+
addAutoFix(error, importSource, "".concat(replacement.location, "/").concat(replacement.type, "/migration/").concat(replacement.name, "--").concat(legacyIconName), newIconName);
|
|
88
|
+
}
|
|
80
89
|
}
|
|
81
90
|
} else {
|
|
82
91
|
var _metadata2;
|
|
@@ -94,7 +103,9 @@ export var getDeprecationIconHandler = function getDeprecationIconHandler(contex
|
|
|
94
103
|
var _replacement = (_metadata2 = _metadata) === null || _metadata2 === void 0 || (_metadata2 = _metadata2[_name]) === null || _metadata2 === void 0 ? void 0 : _metadata2.replacement;
|
|
95
104
|
if (_replacement) {
|
|
96
105
|
var _newIconName = getIconComponentName(_replacement.name);
|
|
97
|
-
|
|
106
|
+
if (!shouldTurnOffAutoFixer) {
|
|
107
|
+
addAutoFix(error, importSource, "".concat(_replacement.location, "/").concat(_replacement.type, "/").concat(_replacement.name), _newIconName);
|
|
108
|
+
}
|
|
98
109
|
}
|
|
99
110
|
}
|
|
100
111
|
context.report(error);
|
|
@@ -47,6 +47,9 @@ var rule = createLintRule({
|
|
|
47
47
|
schema: [{
|
|
48
48
|
type: 'object',
|
|
49
49
|
properties: {
|
|
50
|
+
turnOffAutoFixer: {
|
|
51
|
+
type: 'boolean'
|
|
52
|
+
},
|
|
50
53
|
deprecatedConfig: {
|
|
51
54
|
type: 'object',
|
|
52
55
|
properties: {
|
|
@@ -75,7 +78,8 @@ var rule = createLintRule({
|
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
|
-
}
|
|
81
|
+
},
|
|
82
|
+
additionalProperties: false
|
|
79
83
|
}]
|
|
80
84
|
},
|
|
81
85
|
create: function create(context) {
|
package/package.json
CHANGED