@atlaskit/eslint-plugin-design-system 8.14.0 → 8.14.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
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 8.14.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#42240](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42240) [`ec474733d38`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ec474733d38) - Handle destructured variables in link item rule.
|
|
8
|
+
|
|
3
9
|
## 8.14.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -30,7 +30,7 @@ var getLinkItemImportName = exports.getLinkItemImportName = function getLinkItem
|
|
|
30
30
|
return (_matchedVariable$defs = matchedVariable.defs) === null || _matchedVariable$defs === void 0 ? void 0 : _matchedVariable$defs[0].node.local.name;
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
var invalidHrefValues = ['', '#'];
|
|
33
|
+
var invalidHrefValues = ['', '#', null, undefined];
|
|
34
34
|
var hrefHasInvalidValue = exports.hrefHasInvalidValue = function hrefHasInvalidValue(scope, href) {
|
|
35
35
|
// If doesn't exist,
|
|
36
36
|
if (!href) {
|
|
@@ -55,9 +55,13 @@ var hrefHasInvalidValue = exports.hrefHasInvalidValue = function hrefHasInvalidV
|
|
|
55
55
|
if (variable) {
|
|
56
56
|
var _defNode$init, _defNode$init2;
|
|
57
57
|
var defNode = variable.defs[0].node;
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
|
|
58
|
+
// Should be accepted as a valid `href` for
|
|
59
|
+
// * imported variables
|
|
60
|
+
// * local variables with an valid value
|
|
61
|
+
// * local variables defined via destructuring
|
|
62
|
+
// * arguments in a function declaration
|
|
63
|
+
// * arguments in an anonymous function
|
|
64
|
+
if (defNode !== null && defNode !== void 0 && defNode.imported || defNode !== null && defNode !== void 0 && (_defNode$init = defNode.init) !== null && _defNode$init !== void 0 && _defNode$init.value && !invalidHrefValues.includes(defNode === null || defNode === void 0 || (_defNode$init2 = defNode.init) === null || _defNode$init2 === void 0 ? void 0 : _defNode$init2.value) || (0, _eslintCodemodUtils.isNodeOfType)(defNode, 'VariableDeclarator') && defNode !== null && defNode !== void 0 && defNode.init && (0, _eslintCodemodUtils.isNodeOfType)(defNode.init, 'Identifier') && (0, _eslintCodemodUtils.isNodeOfType)(defNode.id, 'ObjectPattern') || (0, _eslintCodemodUtils.isNodeOfType)(defNode, 'FunctionDeclaration') || (0, _eslintCodemodUtils.isNodeOfType)(defNode, 'ArrowFunctionExpression')) {
|
|
61
65
|
return false;
|
|
62
66
|
} else {
|
|
63
67
|
return true;
|
|
@@ -24,7 +24,7 @@ export const getLinkItemImportName = scope => {
|
|
|
24
24
|
return (_matchedVariable$defs = matchedVariable.defs) === null || _matchedVariable$defs === void 0 ? void 0 : _matchedVariable$defs[0].node.local.name;
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
const invalidHrefValues = ['', '#'];
|
|
27
|
+
const invalidHrefValues = ['', '#', null, undefined];
|
|
28
28
|
export const hrefHasInvalidValue = (scope, href) => {
|
|
29
29
|
// If doesn't exist,
|
|
30
30
|
if (!href) {
|
|
@@ -49,9 +49,13 @@ export const hrefHasInvalidValue = (scope, href) => {
|
|
|
49
49
|
if (variable) {
|
|
50
50
|
var _defNode$init, _defNode$init2;
|
|
51
51
|
const defNode = variable.defs[0].node;
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
|
|
52
|
+
// Should be accepted as a valid `href` for
|
|
53
|
+
// * imported variables
|
|
54
|
+
// * local variables with an valid value
|
|
55
|
+
// * local variables defined via destructuring
|
|
56
|
+
// * arguments in a function declaration
|
|
57
|
+
// * arguments in an anonymous function
|
|
58
|
+
if (defNode !== null && defNode !== void 0 && defNode.imported || defNode !== null && defNode !== void 0 && (_defNode$init = defNode.init) !== null && _defNode$init !== void 0 && _defNode$init.value && !invalidHrefValues.includes(defNode === null || defNode === void 0 ? void 0 : (_defNode$init2 = defNode.init) === null || _defNode$init2 === void 0 ? void 0 : _defNode$init2.value) || isNodeOfType(defNode, 'VariableDeclarator') && defNode !== null && defNode !== void 0 && defNode.init && isNodeOfType(defNode.init, 'Identifier') && isNodeOfType(defNode.id, 'ObjectPattern') || isNodeOfType(defNode, 'FunctionDeclaration') || isNodeOfType(defNode, 'ArrowFunctionExpression')) {
|
|
55
59
|
return false;
|
|
56
60
|
} else {
|
|
57
61
|
return true;
|
|
@@ -24,7 +24,7 @@ export var getLinkItemImportName = function getLinkItemImportName(scope) {
|
|
|
24
24
|
return (_matchedVariable$defs = matchedVariable.defs) === null || _matchedVariable$defs === void 0 ? void 0 : _matchedVariable$defs[0].node.local.name;
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
var invalidHrefValues = ['', '#'];
|
|
27
|
+
var invalidHrefValues = ['', '#', null, undefined];
|
|
28
28
|
export var hrefHasInvalidValue = function hrefHasInvalidValue(scope, href) {
|
|
29
29
|
// If doesn't exist,
|
|
30
30
|
if (!href) {
|
|
@@ -49,9 +49,13 @@ export var hrefHasInvalidValue = function hrefHasInvalidValue(scope, href) {
|
|
|
49
49
|
if (variable) {
|
|
50
50
|
var _defNode$init, _defNode$init2;
|
|
51
51
|
var defNode = variable.defs[0].node;
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
|
|
52
|
+
// Should be accepted as a valid `href` for
|
|
53
|
+
// * imported variables
|
|
54
|
+
// * local variables with an valid value
|
|
55
|
+
// * local variables defined via destructuring
|
|
56
|
+
// * arguments in a function declaration
|
|
57
|
+
// * arguments in an anonymous function
|
|
58
|
+
if (defNode !== null && defNode !== void 0 && defNode.imported || defNode !== null && defNode !== void 0 && (_defNode$init = defNode.init) !== null && _defNode$init !== void 0 && _defNode$init.value && !invalidHrefValues.includes(defNode === null || defNode === void 0 || (_defNode$init2 = defNode.init) === null || _defNode$init2 === void 0 ? void 0 : _defNode$init2.value) || isNodeOfType(defNode, 'VariableDeclarator') && defNode !== null && defNode !== void 0 && defNode.init && isNodeOfType(defNode.init, 'Identifier') && isNodeOfType(defNode.id, 'ObjectPattern') || isNodeOfType(defNode, 'FunctionDeclaration') || isNodeOfType(defNode, 'ArrowFunctionExpression')) {
|
|
55
59
|
return false;
|
|
56
60
|
} else {
|
|
57
61
|
return true;
|
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": "8.14.
|
|
4
|
+
"version": "8.14.1",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"registry": "https://registry.npmjs.org/"
|