@atlaskit/eslint-plugin-design-system 4.0.0 → 4.2.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 +31 -0
- package/dist/cjs/index.js +14 -3
- package/dist/cjs/rules/ensure-design-token-usage/index.js +3 -0
- package/dist/cjs/rules/no-deprecated-apis/index.js +91 -0
- package/dist/cjs/rules/no-deprecated-design-token-usage/index.js +76 -0
- package/dist/cjs/rules/no-deprecated-imports/index.js +45 -33
- package/dist/cjs/rules/no-deprecated-imports/paths.js +43 -15
- package/dist/cjs/rules/no-unsafe-design-token-usage/index.js +19 -5
- package/dist/cjs/rules/use-visually-hidden/constants.js +12 -0
- package/dist/cjs/rules/use-visually-hidden/fix-jsx.js +39 -0
- package/dist/cjs/rules/use-visually-hidden/fix-vanilla.js +35 -0
- package/dist/cjs/rules/use-visually-hidden/index.js +194 -0
- package/dist/cjs/rules/use-visually-hidden/utils.js +91 -0
- package/dist/cjs/rules/utils/get-import-node-by-source.js +23 -0
- package/dist/cjs/rules/utils/is-color.js +3 -2
- package/dist/cjs/rules/utils/is-node.js +33 -3
- package/dist/cjs/rules/utils/remove-named-import.js +29 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +10 -2
- package/dist/es2019/rules/ensure-design-token-usage/index.js +3 -0
- package/dist/es2019/rules/no-deprecated-apis/index.js +72 -0
- package/dist/es2019/rules/no-deprecated-design-token-usage/index.js +58 -0
- package/dist/es2019/rules/no-deprecated-imports/index.js +45 -32
- package/dist/es2019/rules/no-deprecated-imports/paths.js +41 -14
- package/dist/es2019/rules/no-unsafe-design-token-usage/index.js +12 -5
- package/dist/es2019/rules/use-visually-hidden/constants.js +3 -0
- package/dist/es2019/rules/use-visually-hidden/fix-jsx.js +24 -0
- package/dist/es2019/rules/use-visually-hidden/fix-vanilla.js +21 -0
- package/dist/es2019/rules/use-visually-hidden/index.js +169 -0
- package/dist/es2019/rules/use-visually-hidden/utils.js +62 -0
- package/dist/es2019/rules/utils/get-import-node-by-source.js +10 -0
- package/dist/es2019/rules/utils/is-color.js +2 -1
- package/dist/es2019/rules/utils/is-node.js +19 -2
- package/dist/es2019/rules/utils/remove-named-import.js +16 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +10 -2
- package/dist/esm/rules/ensure-design-token-usage/index.js +3 -0
- package/dist/esm/rules/no-deprecated-apis/index.js +81 -0
- package/dist/esm/rules/no-deprecated-design-token-usage/index.js +66 -0
- package/dist/esm/rules/no-deprecated-imports/index.js +45 -32
- package/dist/esm/rules/no-deprecated-imports/paths.js +41 -14
- package/dist/esm/rules/no-unsafe-design-token-usage/index.js +20 -5
- package/dist/esm/rules/use-visually-hidden/constants.js +3 -0
- package/dist/esm/rules/use-visually-hidden/fix-jsx.js +26 -0
- package/dist/esm/rules/use-visually-hidden/fix-vanilla.js +23 -0
- package/dist/esm/rules/use-visually-hidden/index.js +180 -0
- package/dist/esm/rules/use-visually-hidden/utils.js +74 -0
- package/dist/esm/rules/utils/get-import-node-by-source.js +14 -0
- package/dist/esm/rules/utils/is-color.js +2 -1
- package/dist/esm/rules/utils/is-node.js +22 -1
- package/dist/esm/rules/utils/remove-named-import.js +20 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/rules/no-deprecated-apis/index.d.ts +3 -0
- package/dist/types/rules/no-deprecated-design-token-usage/index.d.ts +3 -0
- package/dist/types/rules/no-deprecated-imports/paths.d.ts +33 -14
- package/dist/types/rules/use-visually-hidden/constants.d.ts +3 -0
- package/dist/types/rules/use-visually-hidden/fix-jsx.d.ts +3 -0
- package/dist/types/rules/use-visually-hidden/fix-vanilla.d.ts +3 -0
- package/dist/types/rules/use-visually-hidden/index.d.ts +3 -0
- package/dist/types/rules/use-visually-hidden/utils.d.ts +35 -0
- package/dist/types/rules/utils/get-import-node-by-source.d.ts +8 -0
- package/dist/types/rules/utils/is-node.d.ts +7 -0
- package/dist/types/rules/utils/remove-named-import.d.ts +8 -0
- package/package.json +6 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-unresolved
|
|
2
|
+
// eslint-disable-next-line @atlaskit/design-system/use-visually-hidden
|
|
3
|
+
var referenceObject = {
|
|
4
|
+
width: '1px',
|
|
5
|
+
height: '1px',
|
|
6
|
+
padding: '0',
|
|
7
|
+
position: 'absolute',
|
|
8
|
+
border: '0',
|
|
9
|
+
clip: 'rect(1px, 1px, 1px, 1px)',
|
|
10
|
+
overflow: 'hidden',
|
|
11
|
+
whiteSpace: 'nowrap'
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Returns the first import in the esprima AST.
|
|
16
|
+
*/
|
|
17
|
+
export var getFirstImport = function getFirstImport(source) {
|
|
18
|
+
return source.ast.body.find(function (node) {
|
|
19
|
+
return node.type === 'ImportDeclaration';
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Takes a template literal and returns [key, value] array of the css properties
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export var makeTemplateLiteralIntoEntries = function makeTemplateLiteralIntoEntries(templateString) {
|
|
27
|
+
return templateString.replace(/\n/g, '').split(/;|{|}/).filter(function (el) {
|
|
28
|
+
return !el.match(/\@/);
|
|
29
|
+
}).map(function (el) {
|
|
30
|
+
return el.trim().split(':').map(function (e) {
|
|
31
|
+
return e.trim();
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Given a node, translate the node into css key-value pairs and
|
|
37
|
+
* compare the output to the reference styles required to make a
|
|
38
|
+
* visually hidden element.
|
|
39
|
+
*
|
|
40
|
+
* @returns {number} A fraction between 0-1 depending on the object's likeness.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
export var getObjectLikeness = function getObjectLikeness(node) {
|
|
44
|
+
var styleEntries = node.properties.map(function (_ref) {
|
|
45
|
+
var type = _ref.type,
|
|
46
|
+
key = _ref.key,
|
|
47
|
+
value = _ref.value;
|
|
48
|
+
|
|
49
|
+
if (type === 'Property' && key.type === 'Identifier') {
|
|
50
|
+
return {
|
|
51
|
+
key: key.name,
|
|
52
|
+
value: value.type === 'Literal' && value.value
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return null;
|
|
57
|
+
}).filter(function (node) {
|
|
58
|
+
return Boolean(node);
|
|
59
|
+
});
|
|
60
|
+
return countMatchingKeyValues(styleEntries);
|
|
61
|
+
};
|
|
62
|
+
export var countMatchingKeyValues = function countMatchingKeyValues(styleEntries) {
|
|
63
|
+
var matchingStyleEntries = styleEntries.filter(function (entry) {
|
|
64
|
+
return entry.key in referenceObject;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
if (styleEntries.length < 5) {
|
|
68
|
+
return 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return matchingStyleEntries.reduce(function (acc, curr) {
|
|
72
|
+
return acc + (referenceObject[curr === null || curr === void 0 ? void 0 : curr.key] === (curr === null || curr === void 0 ? void 0 : curr.value) ? 1.5 : 0.75);
|
|
73
|
+
}, 0) / styleEntries.length;
|
|
74
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable import/no-unresolved */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {SourceCode} source The eslint source
|
|
5
|
+
* @param {string} path The path specified to find
|
|
6
|
+
* @returns {ImportDeclaration}
|
|
7
|
+
*/
|
|
8
|
+
export var getImportedNodeBySource = function getImportedNodeBySource(source, path) {
|
|
9
|
+
return source.ast.body.filter(function (node) {
|
|
10
|
+
return node.type === 'ImportDeclaration';
|
|
11
|
+
}).find(function (node) {
|
|
12
|
+
return node.source.value === path;
|
|
13
|
+
});
|
|
14
|
+
};
|
|
@@ -41,7 +41,8 @@ export var isHardCodedColor = function isHardCodedColor(value) {
|
|
|
41
41
|
return true;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
if (value.startsWith('#') && (
|
|
44
|
+
if (value.startsWith('#') && ( // short hex, hex, or hex with alpha
|
|
45
|
+
value.length === 4 || value.length === 7 || value.length === 9)) {
|
|
45
46
|
return true;
|
|
46
47
|
}
|
|
47
48
|
|
|
@@ -34,6 +34,12 @@ export var isDecendantOfStyleJsxAttribute = function isDecendantOfStyleJsxAttrib
|
|
|
34
34
|
|
|
35
35
|
return false;
|
|
36
36
|
};
|
|
37
|
+
export var isStyledTemplateNode = function isStyledTemplateNode(node) {
|
|
38
|
+
return (node === null || node === void 0 ? void 0 : node.type) === 'TaggedTemplateExpression' && node.tag.type === 'MemberExpression' && node.tag.object.type === 'Identifier' && node.tag.object.name === 'styled';
|
|
39
|
+
};
|
|
40
|
+
export var isStyledObjectNode = function isStyledObjectNode(node) {
|
|
41
|
+
return (node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' && node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && node.callee.object.name === 'styled';
|
|
42
|
+
};
|
|
37
43
|
export var isDecendantOfStyleBlock = function isDecendantOfStyleBlock(node) {
|
|
38
44
|
if (node.type === 'VariableDeclarator') {
|
|
39
45
|
if (node.id.type !== 'Identifier') {
|
|
@@ -65,7 +71,7 @@ export var isDecendantOfStyleBlock = function isDecendantOfStyleBlock(node) {
|
|
|
65
71
|
return true;
|
|
66
72
|
}
|
|
67
73
|
|
|
68
|
-
if (node
|
|
74
|
+
if (isStyledTemplateNode(node)) {
|
|
69
75
|
return true;
|
|
70
76
|
}
|
|
71
77
|
|
|
@@ -81,4 +87,19 @@ export var isDecendantOfStyleBlock = function isDecendantOfStyleBlock(node) {
|
|
|
81
87
|
};
|
|
82
88
|
export var isChildOfType = function isChildOfType(node, type) {
|
|
83
89
|
return node.parent.type === type;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Given a node, walk up the tree until there is no parent OR a common ancestor of the correct type is found
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
export var getClosestNodeOfType = function getClosestNodeOfType(node, type) {
|
|
96
|
+
if (!node) {
|
|
97
|
+
return node;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (node.type === type) {
|
|
101
|
+
return node;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return getClosestNodeOfType(node.parent, type);
|
|
84
105
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* eslint-disable import/no-unresolved */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {SourceCode} source The eslint source
|
|
5
|
+
* @param {string} path The path specified to find
|
|
6
|
+
* @returns FixerObject
|
|
7
|
+
*/
|
|
8
|
+
export var removeNamedImport = function removeNamedImport(fixer, importNode, name) {
|
|
9
|
+
var filteredSpecifers = importNode.specifiers.filter(function (node) {
|
|
10
|
+
return node.type === 'ImportSpecifier' && node.imported.name !== name;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
if (filteredSpecifers.length) {
|
|
14
|
+
return fixer.remove(importNode.specifiers.find(function (node) {
|
|
15
|
+
return node.type === 'ImportSpecifier' && node.imported.name === name;
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return fixer.remove(importNode);
|
|
20
|
+
};
|
package/dist/esm/version.json
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
export declare const rules: {
|
|
2
2
|
'ensure-design-token-usage': import("eslint").Rule.RuleModule;
|
|
3
3
|
'no-unsafe-design-token-usage': import("eslint").Rule.RuleModule;
|
|
4
|
+
'no-deprecated-design-token-usage': import("eslint").Rule.RuleModule;
|
|
4
5
|
'no-deprecated-imports': import("eslint").Rule.RuleModule;
|
|
6
|
+
'no-deprecated-apis': import("eslint").Rule.RuleModule;
|
|
7
|
+
'use-visually-hidden': import("eslint").Rule.RuleModule;
|
|
5
8
|
};
|
|
6
9
|
export declare const configs: {
|
|
7
10
|
recommended: {
|
|
8
11
|
plugins: string[];
|
|
9
12
|
rules: {
|
|
10
13
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
14
|
+
'@atlaskit/design-system/use-visually-hidden': string;
|
|
15
|
+
'@atlaskit/design-system/no-deprecated-apis': string;
|
|
11
16
|
};
|
|
12
17
|
};
|
|
13
18
|
};
|
|
@@ -1,43 +1,62 @@
|
|
|
1
|
+
export declare const namedThemeExports: {
|
|
2
|
+
importName: string;
|
|
3
|
+
message: string;
|
|
4
|
+
}[];
|
|
1
5
|
export declare const restrictedPaths: readonly [{
|
|
2
|
-
readonly
|
|
6
|
+
readonly path: "@atlaskit/navigation-next";
|
|
3
7
|
readonly message: "navigation-next is deprecated. Please use '@atlaskit/atlassian-navigation' instead.";
|
|
4
8
|
}, {
|
|
5
|
-
readonly
|
|
9
|
+
readonly path: "@atlaskit/field-base";
|
|
6
10
|
readonly message: "field-base is deprecated. Please use the '@atlaskit/form' package instead.";
|
|
7
11
|
}, {
|
|
8
|
-
readonly
|
|
12
|
+
readonly path: "@atlaskit/field-radio-group";
|
|
9
13
|
readonly message: "field-radio-group is deprecated. Please use '@atlaskit/radio' instead, and check the migration guide.";
|
|
10
14
|
}, {
|
|
11
|
-
readonly
|
|
15
|
+
readonly path: "@atlaskit/field-range";
|
|
12
16
|
readonly message: "field-range is deprecated. Please use '@atlaskit/range' instead.";
|
|
13
17
|
}, {
|
|
14
|
-
readonly
|
|
18
|
+
readonly path: "@atlaskit/field-text";
|
|
15
19
|
readonly message: "field-text is deprecated. Please use '@atlaskit/textfield' instead.";
|
|
16
20
|
}, {
|
|
17
|
-
readonly
|
|
21
|
+
readonly path: "@atlaskit/field-text-area";
|
|
18
22
|
readonly message: "field-text-area is deprecated. Please use '@atlaskit/textarea' instead.";
|
|
19
23
|
}, {
|
|
20
|
-
readonly
|
|
24
|
+
readonly path: "@atlaskit/navigation";
|
|
21
25
|
readonly message: "navigation is deprecated. Please use '@atlaskit/atlassian-navigation' instead.";
|
|
22
26
|
}, {
|
|
23
|
-
readonly
|
|
27
|
+
readonly path: "@atlaskit/global-navigation";
|
|
24
28
|
readonly message: "global-navigation is deprecated. Please use '@atlaskit/atlassian-navigation' for the horizontal nav bar, '@atlaskit/side-navigation' for the side nav, and '@atlaskit/page-layout' to layout your application.";
|
|
25
29
|
}, {
|
|
26
|
-
readonly
|
|
30
|
+
readonly path: "@atlaskit/input";
|
|
27
31
|
readonly message: "input is deprecated. This was an internal component and should not be used directly.";
|
|
28
32
|
}, {
|
|
29
|
-
readonly
|
|
33
|
+
readonly path: "@atlaskit/layer";
|
|
30
34
|
readonly message: "layer is deprecated. This was an internal component and should not be used directly.";
|
|
31
35
|
}, {
|
|
32
|
-
readonly
|
|
36
|
+
readonly path: "@atlaskit/single-select";
|
|
33
37
|
readonly message: "single-select is deprecated. Please use '@atlaskit/select' instead.";
|
|
34
38
|
}, {
|
|
35
|
-
readonly
|
|
39
|
+
readonly path: "@atlaskit/multi-select";
|
|
36
40
|
readonly message: "multi-select is deprecated. Please use '@atlaskit/select' instead.";
|
|
37
41
|
}, {
|
|
38
|
-
readonly
|
|
42
|
+
readonly path: "@atlaskit/droplist";
|
|
39
43
|
readonly message: "droplist is deprecated. For the pop-up behaviour please use '@atlaskit/popup' and for common menu components please use '@atlaskit/menu'.";
|
|
40
44
|
}, {
|
|
41
|
-
readonly
|
|
45
|
+
readonly path: "@atlaskit/item";
|
|
42
46
|
readonly message: "item is deprecated. Please use '@atlaskit/menu' instead.";
|
|
47
|
+
}, {
|
|
48
|
+
readonly path: "@atlaskit/theme/constants";
|
|
49
|
+
readonly imports: {
|
|
50
|
+
importName: string;
|
|
51
|
+
message: string;
|
|
52
|
+
}[];
|
|
53
|
+
}, {
|
|
54
|
+
readonly path: "@atlaskit/theme";
|
|
55
|
+
readonly imports: {
|
|
56
|
+
importName: string;
|
|
57
|
+
message: string;
|
|
58
|
+
}[];
|
|
59
|
+
}, {
|
|
60
|
+
readonly path: "@atlaskit/icon-priority";
|
|
61
|
+
readonly message: "icon-priority is deprecated due to limited usage in Cloud products. It will be deleted after 21 April 2022.";
|
|
43
62
|
}];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SourceCode } from 'eslint';
|
|
2
|
+
import type { ObjectExpression } from 'estree';
|
|
3
|
+
declare const referenceObject: {
|
|
4
|
+
width: string;
|
|
5
|
+
height: string;
|
|
6
|
+
padding: string;
|
|
7
|
+
position: string;
|
|
8
|
+
border: string;
|
|
9
|
+
clip: string;
|
|
10
|
+
overflow: string;
|
|
11
|
+
whiteSpace: string;
|
|
12
|
+
};
|
|
13
|
+
declare type KeyValue = {
|
|
14
|
+
key: string;
|
|
15
|
+
value: string;
|
|
16
|
+
};
|
|
17
|
+
export declare type ReferenceObject = typeof referenceObject;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the first import in the esprima AST.
|
|
20
|
+
*/
|
|
21
|
+
export declare const getFirstImport: (source: SourceCode) => import("estree").FunctionDeclaration | import("estree").ExpressionStatement | import("estree").BlockStatement | import("estree").EmptyStatement | import("estree").DebuggerStatement | import("estree").WithStatement | import("estree").ReturnStatement | import("estree").LabeledStatement | import("estree").BreakStatement | import("estree").ContinueStatement | import("estree").IfStatement | import("estree").SwitchStatement | import("estree").ThrowStatement | import("estree").TryStatement | import("estree").WhileStatement | import("estree").DoWhileStatement | import("estree").ForStatement | import("estree").ForInStatement | import("estree").ForOfStatement | import("estree").VariableDeclaration | import("estree").ClassDeclaration | import("estree").ImportDeclaration | import("estree").ExportNamedDeclaration | import("estree").ExportDefaultDeclaration | import("estree").ExportAllDeclaration | import("estree").Directive | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Takes a template literal and returns [key, value] array of the css properties
|
|
24
|
+
*/
|
|
25
|
+
export declare const makeTemplateLiteralIntoEntries: (templateString: string) => string[][];
|
|
26
|
+
/**
|
|
27
|
+
* Given a node, translate the node into css key-value pairs and
|
|
28
|
+
* compare the output to the reference styles required to make a
|
|
29
|
+
* visually hidden element.
|
|
30
|
+
*
|
|
31
|
+
* @returns {number} A fraction between 0-1 depending on the object's likeness.
|
|
32
|
+
*/
|
|
33
|
+
export declare const getObjectLikeness: (node: ObjectExpression) => number;
|
|
34
|
+
export declare const countMatchingKeyValues: (styleEntries: KeyValue[]) => number;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SourceCode } from 'eslint';
|
|
2
|
+
import type { ImportDeclaration } from 'estree';
|
|
3
|
+
/**
|
|
4
|
+
* @param {SourceCode} source The eslint source
|
|
5
|
+
* @param {string} path The path specified to find
|
|
6
|
+
* @returns {ImportDeclaration}
|
|
7
|
+
*/
|
|
8
|
+
export declare const getImportedNodeBySource: (source: SourceCode, path: string) => ImportDeclaration | undefined;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
+
import type { CallExpression, TaggedTemplateExpression } from 'estree';
|
|
2
3
|
export declare const isDecendantOfGlobalToken: (node: Rule.Node) => boolean;
|
|
3
4
|
export declare const isDecendantOfType: (node: Rule.Node, type: Rule.Node['type'], skipNode?: boolean) => boolean;
|
|
4
5
|
export declare const isDecendantOfStyleJsxAttribute: (node: Rule.Node) => boolean;
|
|
6
|
+
export declare const isStyledTemplateNode: (node?: import("estree").Identifier | import("estree").SimpleLiteral | import("estree").RegExpLiteral | import("estree").FunctionExpression | import("estree").ArrowFunctionExpression | import("estree").ThisExpression | import("estree").ArrayExpression | import("estree").ObjectExpression | import("estree").YieldExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").BinaryExpression | import("estree").AssignmentExpression | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").ConditionalExpression | import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").SequenceExpression | import("estree").TemplateLiteral | TaggedTemplateExpression | import("estree").ClassExpression | import("estree").MetaProperty | import("estree").AwaitExpression | null | undefined) => node is TaggedTemplateExpression;
|
|
7
|
+
export declare const isStyledObjectNode: (node?: import("estree").Identifier | import("estree").SimpleLiteral | import("estree").RegExpLiteral | import("estree").FunctionExpression | import("estree").ArrowFunctionExpression | import("estree").ThisExpression | import("estree").ArrayExpression | import("estree").ObjectExpression | import("estree").YieldExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").BinaryExpression | import("estree").AssignmentExpression | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").ConditionalExpression | import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").SequenceExpression | import("estree").TemplateLiteral | TaggedTemplateExpression | import("estree").ClassExpression | import("estree").MetaProperty | import("estree").AwaitExpression | null | undefined) => node is CallExpression;
|
|
5
8
|
export declare const isDecendantOfStyleBlock: (node: Rule.Node) => boolean;
|
|
6
9
|
export declare const isChildOfType: (node: Rule.Node, type: Rule.Node['type']) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Given a node, walk up the tree until there is no parent OR a common ancestor of the correct type is found
|
|
12
|
+
*/
|
|
13
|
+
export declare const getClosestNodeOfType: (node: Rule.Node, type: Rule.NodeTypes) => Rule.Node;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import type { ImportDeclaration } from 'estree';
|
|
3
|
+
/**
|
|
4
|
+
* @param {SourceCode} source The eslint source
|
|
5
|
+
* @param {string} path The path specified to find
|
|
6
|
+
* @returns FixerObject
|
|
7
|
+
*/
|
|
8
|
+
export declare const removeNamedImport: (fixer: Rule.RuleFixer, importNode: ImportDeclaration, name: string) => Rule.Fix;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/eslint-plugin-design-system",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"author": "Atlassian Pty Ltd",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -20,12 +20,16 @@
|
|
|
20
20
|
".": "./src/index.tsx"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@atlaskit/tokens": "^0.
|
|
23
|
+
"@atlaskit/tokens": "^0.6.0",
|
|
24
24
|
"@babel/runtime": "^7.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
+
"@atlaskit/theme": "^12.0.2",
|
|
27
28
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
29
|
+
"@emotion/core": "^10.0.9",
|
|
30
|
+
"@emotion/styled": "^10.0.7",
|
|
28
31
|
"eslint": "^7.7.0",
|
|
32
|
+
"react": "^16.8.0",
|
|
29
33
|
"ts-node": "^10.0.0",
|
|
30
34
|
"tsconfig-paths": "^3.9.0",
|
|
31
35
|
"typescript": "3.9.6"
|