@atlaskit/eslint-plugin-design-system 10.12.4 → 10.13.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 +24 -0
- package/dist/cjs/rules/no-legacy-icons/checks.js +90 -44
- package/dist/cjs/rules/no-legacy-icons/helpers.js +44 -12
- package/dist/cjs/rules/no-legacy-icons/index.js +5 -3
- package/dist/cjs/rules/use-heading/config/index.js +2 -1
- package/dist/cjs/rules/use-heading/transformers/native-elements.js +61 -31
- package/dist/cjs/rules/use-primitives-text/config/index.js +2 -1
- package/dist/cjs/rules/use-primitives-text/transformers/emphasis-elements.js +48 -26
- package/dist/cjs/rules/use-primitives-text/transformers/paragraph-elements.js +62 -51
- package/dist/cjs/rules/use-primitives-text/transformers/span-elements.js +56 -32
- package/dist/cjs/rules/use-primitives-text/transformers/strong-elements.js +48 -26
- package/dist/es2019/rules/no-legacy-icons/checks.js +75 -33
- package/dist/es2019/rules/no-legacy-icons/helpers.js +43 -11
- package/dist/es2019/rules/no-legacy-icons/index.js +5 -3
- package/dist/es2019/rules/use-heading/config/index.js +2 -1
- package/dist/es2019/rules/use-heading/transformers/native-elements.js +60 -29
- package/dist/es2019/rules/use-primitives-text/config/index.js +2 -1
- package/dist/es2019/rules/use-primitives-text/transformers/emphasis-elements.js +47 -24
- package/dist/es2019/rules/use-primitives-text/transformers/paragraph-elements.js +63 -52
- package/dist/es2019/rules/use-primitives-text/transformers/span-elements.js +55 -30
- package/dist/es2019/rules/use-primitives-text/transformers/strong-elements.js +47 -24
- package/dist/esm/rules/no-legacy-icons/checks.js +91 -45
- package/dist/esm/rules/no-legacy-icons/helpers.js +43 -11
- package/dist/esm/rules/no-legacy-icons/index.js +5 -3
- package/dist/esm/rules/use-heading/config/index.js +2 -1
- package/dist/esm/rules/use-heading/transformers/native-elements.js +61 -31
- package/dist/esm/rules/use-primitives-text/config/index.js +2 -1
- package/dist/esm/rules/use-primitives-text/transformers/emphasis-elements.js +48 -26
- package/dist/esm/rules/use-primitives-text/transformers/paragraph-elements.js +62 -51
- package/dist/esm/rules/use-primitives-text/transformers/span-elements.js +56 -32
- package/dist/esm/rules/use-primitives-text/transformers/strong-elements.js +48 -26
- package/dist/types/rules/no-legacy-icons/checks.d.ts +4 -1
- package/dist/types/rules/no-legacy-icons/helpers.d.ts +21 -14
- package/dist/types/rules/use-heading/config/index.d.ts +2 -1
- package/dist/types/rules/use-heading/transformers/native-elements.d.ts +5 -1
- package/dist/types/rules/use-primitives-text/config/index.d.ts +1 -0
- package/dist/types/rules/use-primitives-text/transformers/emphasis-elements.d.ts +6 -1
- package/dist/types/rules/use-primitives-text/transformers/paragraph-elements.d.ts +1 -0
- package/dist/types/rules/use-primitives-text/transformers/span-elements.d.ts +6 -1
- package/dist/types/rules/use-primitives-text/transformers/strong-elements.d.ts +6 -1
- package/dist/types-ts4.5/rules/no-legacy-icons/checks.d.ts +4 -1
- package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +21 -14
- package/dist/types-ts4.5/rules/use-heading/config/index.d.ts +2 -1
- package/dist/types-ts4.5/rules/use-heading/transformers/native-elements.d.ts +5 -1
- package/dist/types-ts4.5/rules/use-primitives-text/config/index.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/emphasis-elements.d.ts +6 -1
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/paragraph-elements.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/span-elements.d.ts +6 -1
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/strong-elements.d.ts +6 -1
- package/package.json +2 -2
|
@@ -24,53 +24,75 @@ var EmphasisElements = exports.EmphasisElements = {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// Check whether all criteria needed to make a transformation are met
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} : {
|
|
43
|
-
suggest: [{
|
|
44
|
-
desc: "Convert to Text",
|
|
27
|
+
var _EmphasisElements$_ch = EmphasisElements._check(node, {
|
|
28
|
+
context: context,
|
|
29
|
+
config: config
|
|
30
|
+
}),
|
|
31
|
+
success = _EmphasisElements$_ch.success,
|
|
32
|
+
autoFixable = _EmphasisElements$_ch.autoFixable;
|
|
33
|
+
if (success && autoFixable) {
|
|
34
|
+
var fix = EmphasisElements._fix(node, {
|
|
35
|
+
context: context,
|
|
36
|
+
config: config
|
|
37
|
+
});
|
|
38
|
+
context.report(_objectSpread({
|
|
39
|
+
node: node.openingElement,
|
|
40
|
+
messageId: 'preferPrimitivesText'
|
|
41
|
+
}, config.enableUnsafeAutofix ? {
|
|
45
42
|
fix: fix
|
|
46
|
-
}
|
|
47
|
-
|
|
43
|
+
} : {
|
|
44
|
+
suggest: [{
|
|
45
|
+
desc: "Convert to Text",
|
|
46
|
+
fix: fix
|
|
47
|
+
}]
|
|
48
|
+
}));
|
|
49
|
+
} else if (success && config.enableUnsafeReport) {
|
|
50
|
+
context.report({
|
|
51
|
+
node: node.openingElement,
|
|
52
|
+
messageId: 'preferPrimitivesText'
|
|
53
|
+
});
|
|
54
|
+
}
|
|
48
55
|
},
|
|
49
56
|
_check: function _check(node, _ref2) {
|
|
50
57
|
var context = _ref2.context,
|
|
51
58
|
config = _ref2.config;
|
|
52
59
|
if (!config.patterns.includes('emphasis-elements')) {
|
|
53
|
-
return
|
|
60
|
+
return {
|
|
61
|
+
success: false
|
|
62
|
+
};
|
|
54
63
|
}
|
|
55
64
|
var elementName = ast.JSXElement.getName(node);
|
|
56
65
|
if (elementName !== 'em') {
|
|
57
|
-
return
|
|
66
|
+
return {
|
|
67
|
+
success: false
|
|
68
|
+
};
|
|
58
69
|
}
|
|
59
70
|
if (!node.children.length) {
|
|
60
|
-
return
|
|
71
|
+
return {
|
|
72
|
+
success: false
|
|
73
|
+
};
|
|
61
74
|
}
|
|
62
75
|
|
|
63
76
|
// Element has no unallowed props
|
|
64
77
|
if (!ast.JSXElement.hasAllowedAttrsOnly(node, _common.allowedAttrs)) {
|
|
65
|
-
return
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
autoFixable: false
|
|
81
|
+
};
|
|
66
82
|
}
|
|
67
83
|
|
|
68
84
|
// If there is more than one `@atlaskit/primitives` import, then it becomes difficult to determine which import to transform
|
|
69
85
|
var importDeclaration = ast.Root.findImportsByModule(context.getSourceCode().ast.body, '@atlaskit/primitives');
|
|
70
86
|
if (importDeclaration.length > 1) {
|
|
71
|
-
return
|
|
87
|
+
return {
|
|
88
|
+
success: true,
|
|
89
|
+
autoFixable: false
|
|
90
|
+
};
|
|
72
91
|
}
|
|
73
|
-
return
|
|
92
|
+
return {
|
|
93
|
+
success: true,
|
|
94
|
+
autoFixable: true
|
|
95
|
+
};
|
|
74
96
|
},
|
|
75
97
|
_fix: function _fix(node, _ref3) {
|
|
76
98
|
var context = _ref3.context,
|
|
@@ -29,55 +29,60 @@ var ParagraphElements = exports.ParagraphElements = {
|
|
|
29
29
|
config: config
|
|
30
30
|
}),
|
|
31
31
|
success = _ParagraphElements$_c.success,
|
|
32
|
+
autoFixable = _ParagraphElements$_c.autoFixable,
|
|
32
33
|
refs = _ParagraphElements$_c.refs;
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
messageId: 'preferPrimitivesStackedText'
|
|
57
|
-
}, config.enableUnsafeAutofix ? {
|
|
58
|
-
fix: fix
|
|
59
|
-
} : {
|
|
60
|
-
suggest: [{
|
|
61
|
-
desc: "Convert to Text and Stack",
|
|
34
|
+
if (success && autoFixable) {
|
|
35
|
+
if (refs.siblings.length > 1) {
|
|
36
|
+
var _refs$siblings$0$loc, _refs$siblings$loc;
|
|
37
|
+
/**
|
|
38
|
+
* Highlighting from first opening element to last closing element
|
|
39
|
+
* to indicate fix will change all p elements and wrap them in a Stack,
|
|
40
|
+
* falls back to first opening element.
|
|
41
|
+
*/
|
|
42
|
+
var startLoc = (_refs$siblings$0$loc = refs.siblings[0].loc) === null || _refs$siblings$0$loc === void 0 ? void 0 : _refs$siblings$0$loc.start;
|
|
43
|
+
var endLoc = (_refs$siblings$loc = refs.siblings[refs.siblings.length - 1].loc) === null || _refs$siblings$loc === void 0 ? void 0 : _refs$siblings$loc.end;
|
|
44
|
+
var fix = ParagraphElements._fixMultiple(node, {
|
|
45
|
+
context: context,
|
|
46
|
+
config: config,
|
|
47
|
+
refs: refs
|
|
48
|
+
});
|
|
49
|
+
context.report(_objectSpread({
|
|
50
|
+
loc: startLoc && endLoc && {
|
|
51
|
+
start: startLoc,
|
|
52
|
+
end: endLoc
|
|
53
|
+
},
|
|
54
|
+
node: node.openingElement,
|
|
55
|
+
messageId: 'preferPrimitivesStackedText'
|
|
56
|
+
}, config.enableUnsafeAutofix ? {
|
|
62
57
|
fix: fix
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
58
|
+
} : {
|
|
59
|
+
suggest: [{
|
|
60
|
+
desc: "Convert to Text and Stack",
|
|
61
|
+
fix: fix
|
|
62
|
+
}]
|
|
63
|
+
}));
|
|
64
|
+
} else {
|
|
65
|
+
var _fix = ParagraphElements._fixSingle(node, {
|
|
66
|
+
context: context,
|
|
67
|
+
config: config
|
|
68
|
+
});
|
|
69
|
+
context.report(_objectSpread({
|
|
70
|
+
node: node.openingElement,
|
|
71
|
+
messageId: 'preferPrimitivesText'
|
|
72
|
+
}, config.enableUnsafeAutofix ? {
|
|
78
73
|
fix: _fix
|
|
79
|
-
}
|
|
80
|
-
|
|
74
|
+
} : {
|
|
75
|
+
suggest: [{
|
|
76
|
+
desc: "Convert to Text",
|
|
77
|
+
fix: _fix
|
|
78
|
+
}]
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
} else if (success && config.enableUnsafeReport) {
|
|
82
|
+
context.report({
|
|
83
|
+
node: node.openingElement,
|
|
84
|
+
messageId: 'preferPrimitivesText'
|
|
85
|
+
});
|
|
81
86
|
}
|
|
82
87
|
},
|
|
83
88
|
_check: function _check(node, _ref2) {
|
|
@@ -112,7 +117,8 @@ var ParagraphElements = exports.ParagraphElements = {
|
|
|
112
117
|
// All siblings have to be paragraph elements with no unallowed props
|
|
113
118
|
if (!(0, _eslintCodemodUtils.isNodeOfType)(node.parent, 'JSXElement')) {
|
|
114
119
|
return {
|
|
115
|
-
success:
|
|
120
|
+
success: true,
|
|
121
|
+
autoFixable: false,
|
|
116
122
|
refs: {
|
|
117
123
|
siblings: []
|
|
118
124
|
}
|
|
@@ -124,7 +130,8 @@ var ParagraphElements = exports.ParagraphElements = {
|
|
|
124
130
|
// Only report for the first p element by comparing node location
|
|
125
131
|
if (((_siblings$0$range = siblings[0].range) === null || _siblings$0$range === void 0 ? void 0 : _siblings$0$range[0]) !== ((_node$range = node.range) === null || _node$range === void 0 ? void 0 : _node$range[0]) || ((_siblings$0$range2 = siblings[0].range) === null || _siblings$0$range2 === void 0 ? void 0 : _siblings$0$range2[1]) !== ((_node$range2 = node.range) === null || _node$range2 === void 0 ? void 0 : _node$range2[1])) {
|
|
126
132
|
return {
|
|
127
|
-
success:
|
|
133
|
+
success: true,
|
|
134
|
+
autoFixable: false,
|
|
128
135
|
refs: {
|
|
129
136
|
siblings: siblings
|
|
130
137
|
}
|
|
@@ -142,7 +149,8 @@ var ParagraphElements = exports.ParagraphElements = {
|
|
|
142
149
|
});
|
|
143
150
|
if (!siblingsMatch) {
|
|
144
151
|
return {
|
|
145
|
-
success:
|
|
152
|
+
success: true,
|
|
153
|
+
autoFixable: false,
|
|
146
154
|
refs: {
|
|
147
155
|
siblings: siblings
|
|
148
156
|
}
|
|
@@ -150,7 +158,8 @@ var ParagraphElements = exports.ParagraphElements = {
|
|
|
150
158
|
}
|
|
151
159
|
} else if (!ast.JSXElement.hasAllowedAttrsOnly(node, _common.allowedAttrs)) {
|
|
152
160
|
return {
|
|
153
|
-
success:
|
|
161
|
+
success: true,
|
|
162
|
+
autoFixable: false,
|
|
154
163
|
refs: {
|
|
155
164
|
siblings: siblings
|
|
156
165
|
}
|
|
@@ -161,7 +170,8 @@ var ParagraphElements = exports.ParagraphElements = {
|
|
|
161
170
|
// If there is more than one `@atlaskit/primitives` import, then it becomes difficult to determine which import to transform
|
|
162
171
|
if (importDeclaration.length > 1) {
|
|
163
172
|
return {
|
|
164
|
-
success:
|
|
173
|
+
success: true,
|
|
174
|
+
autoFixable: false,
|
|
165
175
|
refs: {
|
|
166
176
|
siblings: siblings
|
|
167
177
|
}
|
|
@@ -169,6 +179,7 @@ var ParagraphElements = exports.ParagraphElements = {
|
|
|
169
179
|
}
|
|
170
180
|
return {
|
|
171
181
|
success: true,
|
|
182
|
+
autoFixable: true,
|
|
172
183
|
refs: {
|
|
173
184
|
siblings: siblings
|
|
174
185
|
}
|
|
@@ -24,58 +24,82 @@ var SpanElements = exports.SpanElements = {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// Check whether all criteria needed to make a transformation are met
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} : {
|
|
43
|
-
suggest: [{
|
|
44
|
-
desc: "Convert to Text",
|
|
27
|
+
var _SpanElements$_check = SpanElements._check(node, {
|
|
28
|
+
context: context,
|
|
29
|
+
config: config
|
|
30
|
+
}),
|
|
31
|
+
success = _SpanElements$_check.success,
|
|
32
|
+
autoFixable = _SpanElements$_check.autoFixable;
|
|
33
|
+
if (success && autoFixable) {
|
|
34
|
+
var fix = SpanElements._fix(node, {
|
|
35
|
+
context: context,
|
|
36
|
+
config: config
|
|
37
|
+
});
|
|
38
|
+
context.report(_objectSpread({
|
|
39
|
+
node: node.openingElement,
|
|
40
|
+
messageId: 'preferPrimitivesText'
|
|
41
|
+
}, config.enableUnsafeAutofix ? {
|
|
45
42
|
fix: fix
|
|
46
|
-
}
|
|
47
|
-
|
|
43
|
+
} : {
|
|
44
|
+
suggest: [{
|
|
45
|
+
desc: "Convert to Text",
|
|
46
|
+
fix: fix
|
|
47
|
+
}]
|
|
48
|
+
}));
|
|
49
|
+
} else if (success && config.enableUnsafeReport) {
|
|
50
|
+
context.report({
|
|
51
|
+
node: node.openingElement,
|
|
52
|
+
messageId: 'preferPrimitivesText'
|
|
53
|
+
});
|
|
54
|
+
}
|
|
48
55
|
},
|
|
49
56
|
_check: function _check(node, _ref2) {
|
|
50
57
|
var context = _ref2.context,
|
|
51
58
|
config = _ref2.config;
|
|
52
59
|
if (!config.patterns.includes('span-elements')) {
|
|
53
|
-
return
|
|
60
|
+
return {
|
|
61
|
+
success: false
|
|
62
|
+
};
|
|
54
63
|
}
|
|
55
64
|
var elementName = ast.JSXElement.getName(node);
|
|
56
65
|
if (elementName !== 'span') {
|
|
57
|
-
return
|
|
66
|
+
return {
|
|
67
|
+
success: false
|
|
68
|
+
};
|
|
58
69
|
}
|
|
59
70
|
if (!node.children.length) {
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// Element has no unallowed props
|
|
64
|
-
if (!ast.JSXElement.hasAllowedAttrsOnly(node, _common.allowedAttrs)) {
|
|
65
|
-
return false;
|
|
71
|
+
return {
|
|
72
|
+
success: false
|
|
73
|
+
};
|
|
66
74
|
}
|
|
67
75
|
|
|
68
76
|
// Only allow elements with strings as children
|
|
69
77
|
if (!(0, _common.hasTextChildrenOnly)(node)) {
|
|
70
|
-
return
|
|
78
|
+
return {
|
|
79
|
+
success: false
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Element has no unallowed props
|
|
84
|
+
if (!ast.JSXElement.hasAllowedAttrsOnly(node, _common.allowedAttrs)) {
|
|
85
|
+
return {
|
|
86
|
+
success: true,
|
|
87
|
+
autoFixable: false
|
|
88
|
+
};
|
|
71
89
|
}
|
|
72
|
-
var importDeclaration = ast.Root.findImportsByModule(context.getSourceCode().ast.body, '@atlaskit/primitives');
|
|
73
90
|
|
|
74
91
|
// If there is more than one `@atlaskit/primitives` import, then it becomes difficult to determine which import to transform
|
|
92
|
+
var importDeclaration = ast.Root.findImportsByModule(context.getSourceCode().ast.body, '@atlaskit/primitives');
|
|
75
93
|
if (importDeclaration.length > 1) {
|
|
76
|
-
return
|
|
94
|
+
return {
|
|
95
|
+
success: true,
|
|
96
|
+
autoFixable: false
|
|
97
|
+
};
|
|
77
98
|
}
|
|
78
|
-
return
|
|
99
|
+
return {
|
|
100
|
+
success: true,
|
|
101
|
+
autoFixable: true
|
|
102
|
+
};
|
|
79
103
|
},
|
|
80
104
|
_fix: function _fix(node, _ref3) {
|
|
81
105
|
var context = _ref3.context,
|
|
@@ -24,53 +24,75 @@ var StrongElements = exports.StrongElements = {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// Check whether all criteria needed to make a transformation are met
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} : {
|
|
43
|
-
suggest: [{
|
|
44
|
-
desc: "Convert to Text",
|
|
27
|
+
var _StrongElements$_chec = StrongElements._check(node, {
|
|
28
|
+
context: context,
|
|
29
|
+
config: config
|
|
30
|
+
}),
|
|
31
|
+
success = _StrongElements$_chec.success,
|
|
32
|
+
autoFixable = _StrongElements$_chec.autoFixable;
|
|
33
|
+
if (success && autoFixable) {
|
|
34
|
+
var fix = StrongElements._fix(node, {
|
|
35
|
+
context: context,
|
|
36
|
+
config: config
|
|
37
|
+
});
|
|
38
|
+
context.report(_objectSpread({
|
|
39
|
+
node: node.openingElement,
|
|
40
|
+
messageId: 'preferPrimitivesText'
|
|
41
|
+
}, config.enableUnsafeAutofix ? {
|
|
45
42
|
fix: fix
|
|
46
|
-
}
|
|
47
|
-
|
|
43
|
+
} : {
|
|
44
|
+
suggest: [{
|
|
45
|
+
desc: "Convert to Text",
|
|
46
|
+
fix: fix
|
|
47
|
+
}]
|
|
48
|
+
}));
|
|
49
|
+
} else if (success && config.enableUnsafeReport) {
|
|
50
|
+
context.report({
|
|
51
|
+
node: node.openingElement,
|
|
52
|
+
messageId: 'preferPrimitivesText'
|
|
53
|
+
});
|
|
54
|
+
}
|
|
48
55
|
},
|
|
49
56
|
_check: function _check(node, _ref2) {
|
|
50
57
|
var context = _ref2.context,
|
|
51
58
|
config = _ref2.config;
|
|
52
59
|
if (!config.patterns.includes('strong-elements')) {
|
|
53
|
-
return
|
|
60
|
+
return {
|
|
61
|
+
success: false
|
|
62
|
+
};
|
|
54
63
|
}
|
|
55
64
|
var elementName = ast.JSXElement.getName(node);
|
|
56
65
|
if (elementName !== 'strong') {
|
|
57
|
-
return
|
|
66
|
+
return {
|
|
67
|
+
success: false
|
|
68
|
+
};
|
|
58
69
|
}
|
|
59
70
|
if (!node.children.length) {
|
|
60
|
-
return
|
|
71
|
+
return {
|
|
72
|
+
success: false
|
|
73
|
+
};
|
|
61
74
|
}
|
|
62
75
|
|
|
63
76
|
// Element has no unallowed props
|
|
64
77
|
if (!ast.JSXElement.hasAllowedAttrsOnly(node, _common.allowedAttrs)) {
|
|
65
|
-
return
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
autoFixable: false
|
|
81
|
+
};
|
|
66
82
|
}
|
|
67
83
|
|
|
68
84
|
// If there is more than one `@atlaskit/primitives` import, then it becomes difficult to determine which import to transform
|
|
69
85
|
var importDeclaration = ast.Root.findImportsByModule(context.getSourceCode().ast.body, '@atlaskit/primitives');
|
|
70
86
|
if (importDeclaration.length > 1) {
|
|
71
|
-
return
|
|
87
|
+
return {
|
|
88
|
+
success: true,
|
|
89
|
+
autoFixable: false
|
|
90
|
+
};
|
|
72
91
|
}
|
|
73
|
-
return
|
|
92
|
+
return {
|
|
93
|
+
success: true,
|
|
94
|
+
autoFixable: true
|
|
95
|
+
};
|
|
74
96
|
},
|
|
75
97
|
_fix: function _fix(node, _ref3) {
|
|
76
98
|
var context = _ref3.context,
|