@atlaskit/eslint-plugin-design-system 13.2.0 → 13.3.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
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 13.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#131514](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131514)
|
|
8
|
+
[`74ddca032fe0f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/74ddca032fe0f) -
|
|
9
|
+
Fixes @atlaskit/eslint-plugin-ui-styling-standard/consistent-css-prop-usage to allow aliased
|
|
10
|
+
imports, eg., import { css as css2 } from '@compiled/react'
|
|
11
|
+
|
|
3
12
|
## 13.2.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
|
@@ -24,9 +24,19 @@ var _getImportNodeBySource = require("../utils/get-import-node-by-source");
|
|
|
24
24
|
var isDOMElementName = function isDOMElementName(elementName) {
|
|
25
25
|
return elementName.charAt(0) !== elementName.charAt(0).toUpperCase() && elementName.charAt(0) === elementName.charAt(0).toLowerCase();
|
|
26
26
|
};
|
|
27
|
-
function isCssCallExpression(node, cssFunctions) {
|
|
27
|
+
function isCssCallExpression(node, cssFunctions, context) {
|
|
28
28
|
cssFunctions = [].concat((0, _toConsumableArray2.default)(cssFunctions), ['cssMap']);
|
|
29
|
-
|
|
29
|
+
if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'CallExpression') || !(0, _eslintCodemodUtils.isNodeOfType)(node.callee, 'Identifier')) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
var module = (0, _getImportNodeBySource.getModuleOfIdentifier)((0, _contextCompat.getSourceCode)(context), node.callee.name);
|
|
33
|
+
if (!module) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
if (!cssFunctions.includes(module.importName)) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
return node.arguments.length > 0 && node.arguments[0].type === 'ObjectExpression';
|
|
30
40
|
}
|
|
31
41
|
function findSpreadProperties(node) {
|
|
32
42
|
return node.properties.filter(function (property) {
|
|
@@ -161,7 +171,7 @@ var JSXExpressionLinter = /*#__PURE__*/function () {
|
|
|
161
171
|
});
|
|
162
172
|
return;
|
|
163
173
|
}
|
|
164
|
-
if (identifier.parent && identifier.parent.init && !isCssCallExpression(identifier.parent.init, this.configuration.cssFunctions)) {
|
|
174
|
+
if (identifier.parent && identifier.parent.init && !isCssCallExpression(identifier.parent.init, this.configuration.cssFunctions, this.context)) {
|
|
165
175
|
// When variable value is not of type css({})
|
|
166
176
|
var value = identifier.parent.init;
|
|
167
177
|
if (!value) {
|
|
@@ -473,7 +483,7 @@ var JSXExpressionLinter = /*#__PURE__*/function () {
|
|
|
473
483
|
}
|
|
474
484
|
|
|
475
485
|
// Don't fix CallExpressions unless they're from cssFunctions or cssMap
|
|
476
|
-
if (expression.type === 'CallExpression' && !isCssCallExpression(expression, _this3.configuration.cssFunctions)) {
|
|
486
|
+
if (expression.type === 'CallExpression' && !isCssCallExpression(expression, _this3.configuration.cssFunctions, _this3.context)) {
|
|
477
487
|
return [];
|
|
478
488
|
}
|
|
479
489
|
if (expression.type === 'ObjectExpression') {
|
|
@@ -11,9 +11,19 @@ import { createLintRule } from '../utils/create-rule';
|
|
|
11
11
|
import { getFirstSupportedImport } from '../utils/get-first-supported-import';
|
|
12
12
|
import { getModuleOfIdentifier } from '../utils/get-import-node-by-source';
|
|
13
13
|
const isDOMElementName = elementName => elementName.charAt(0) !== elementName.charAt(0).toUpperCase() && elementName.charAt(0) === elementName.charAt(0).toLowerCase();
|
|
14
|
-
function isCssCallExpression(node, cssFunctions) {
|
|
14
|
+
function isCssCallExpression(node, cssFunctions, context) {
|
|
15
15
|
cssFunctions = [...cssFunctions, 'cssMap'];
|
|
16
|
-
|
|
16
|
+
if (!isNodeOfType(node, 'CallExpression') || !isNodeOfType(node.callee, 'Identifier')) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const module = getModuleOfIdentifier(getSourceCode(context), node.callee.name);
|
|
20
|
+
if (!module) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (!cssFunctions.includes(module.importName)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return node.arguments.length > 0 && node.arguments[0].type === 'ObjectExpression';
|
|
17
27
|
}
|
|
18
28
|
function findSpreadProperties(node) {
|
|
19
29
|
return node.properties.filter(property => property.type === 'SpreadElement' ||
|
|
@@ -135,7 +145,7 @@ class JSXExpressionLinter {
|
|
|
135
145
|
});
|
|
136
146
|
return;
|
|
137
147
|
}
|
|
138
|
-
if (identifier.parent && identifier.parent.init && !isCssCallExpression(identifier.parent.init, this.configuration.cssFunctions)) {
|
|
148
|
+
if (identifier.parent && identifier.parent.init && !isCssCallExpression(identifier.parent.init, this.configuration.cssFunctions, this.context)) {
|
|
139
149
|
// When variable value is not of type css({})
|
|
140
150
|
const value = identifier.parent.init;
|
|
141
151
|
if (!value) {
|
|
@@ -429,7 +439,7 @@ class JSXExpressionLinter {
|
|
|
429
439
|
}
|
|
430
440
|
|
|
431
441
|
// Don't fix CallExpressions unless they're from cssFunctions or cssMap
|
|
432
|
-
if (expression.type === 'CallExpression' && !isCssCallExpression(expression, this.configuration.cssFunctions)) {
|
|
442
|
+
if (expression.type === 'CallExpression' && !isCssCallExpression(expression, this.configuration.cssFunctions, this.context)) {
|
|
433
443
|
return [];
|
|
434
444
|
}
|
|
435
445
|
if (expression.type === 'ObjectExpression') {
|
|
@@ -17,9 +17,19 @@ import { getModuleOfIdentifier } from '../utils/get-import-node-by-source';
|
|
|
17
17
|
var isDOMElementName = function isDOMElementName(elementName) {
|
|
18
18
|
return elementName.charAt(0) !== elementName.charAt(0).toUpperCase() && elementName.charAt(0) === elementName.charAt(0).toLowerCase();
|
|
19
19
|
};
|
|
20
|
-
function isCssCallExpression(node, cssFunctions) {
|
|
20
|
+
function isCssCallExpression(node, cssFunctions, context) {
|
|
21
21
|
cssFunctions = [].concat(_toConsumableArray(cssFunctions), ['cssMap']);
|
|
22
|
-
|
|
22
|
+
if (!isNodeOfType(node, 'CallExpression') || !isNodeOfType(node.callee, 'Identifier')) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
var module = getModuleOfIdentifier(getSourceCode(context), node.callee.name);
|
|
26
|
+
if (!module) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (!cssFunctions.includes(module.importName)) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return node.arguments.length > 0 && node.arguments[0].type === 'ObjectExpression';
|
|
23
33
|
}
|
|
24
34
|
function findSpreadProperties(node) {
|
|
25
35
|
return node.properties.filter(function (property) {
|
|
@@ -154,7 +164,7 @@ var JSXExpressionLinter = /*#__PURE__*/function () {
|
|
|
154
164
|
});
|
|
155
165
|
return;
|
|
156
166
|
}
|
|
157
|
-
if (identifier.parent && identifier.parent.init && !isCssCallExpression(identifier.parent.init, this.configuration.cssFunctions)) {
|
|
167
|
+
if (identifier.parent && identifier.parent.init && !isCssCallExpression(identifier.parent.init, this.configuration.cssFunctions, this.context)) {
|
|
158
168
|
// When variable value is not of type css({})
|
|
159
169
|
var value = identifier.parent.init;
|
|
160
170
|
if (!value) {
|
|
@@ -466,7 +476,7 @@ var JSXExpressionLinter = /*#__PURE__*/function () {
|
|
|
466
476
|
}
|
|
467
477
|
|
|
468
478
|
// Don't fix CallExpressions unless they're from cssFunctions or cssMap
|
|
469
|
-
if (expression.type === 'CallExpression' && !isCssCallExpression(expression, _this3.configuration.cssFunctions)) {
|
|
479
|
+
if (expression.type === 'CallExpression' && !isCssCallExpression(expression, _this3.configuration.cssFunctions, _this3.context)) {
|
|
470
480
|
return [];
|
|
471
481
|
}
|
|
472
482
|
if (expression.type === 'ObjectExpression') {
|
package/package.json
CHANGED