@atlaskit/eslint-plugin-design-system 8.25.0 → 8.25.2
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 +12 -0
- package/dist/cjs/ast-nodes/object.js +8 -1
- package/dist/cjs/rules/use-button-group-label/index.js +11 -9
- package/dist/cjs/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +5 -0
- package/dist/es2019/ast-nodes/object.js +8 -1
- package/dist/es2019/rules/use-button-group-label/index.js +13 -9
- package/dist/es2019/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +5 -0
- package/dist/esm/ast-nodes/object.js +8 -1
- package/dist/esm/rules/use-button-group-label/index.js +11 -9
- package/dist/esm/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +5 -0
- package/dist/types/ast-nodes/object.d.ts +7 -2
- package/dist/types-ts4.5/ast-nodes/object.d.ts +7 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 8.25.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#71361](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/71361) [`0f3be2c76337`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0f3be2c76337) - `use-primitives` no longer reports elements that have empty style objects.
|
|
8
|
+
|
|
9
|
+
## 8.25.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#67941](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67941) [`0b1def807516`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0b1def807516) - Now rule is aplicable only to ButtonGroup ImportSpecifiers
|
|
14
|
+
|
|
3
15
|
## 8.25.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -54,12 +54,19 @@ var ASTObjectExpression = exports.Object = {
|
|
|
54
54
|
return [fixer.remove(entry)];
|
|
55
55
|
},
|
|
56
56
|
/**
|
|
57
|
-
* Returns
|
|
57
|
+
* Returns only the property @type {Property['key']} like: `padding` from: `{ padding: '8px' }`.
|
|
58
|
+
* If you want the key/value pair, use `getEntryByPropertyName`.
|
|
58
59
|
*/
|
|
59
60
|
getProperty: function getProperty(node, name) {
|
|
60
61
|
var _ASTObjectExpression$;
|
|
61
62
|
return (_ASTObjectExpression$ = ASTObjectExpression.getEntryByPropertyName(node, name)) === null || _ASTObjectExpression$ === void 0 ? void 0 : _ASTObjectExpression$.key;
|
|
62
63
|
},
|
|
64
|
+
/**
|
|
65
|
+
* Gets the array of key/value pairs in an ObjectExpression.
|
|
66
|
+
*/
|
|
67
|
+
getEntries: function getEntries(node) {
|
|
68
|
+
return node.properties;
|
|
69
|
+
},
|
|
63
70
|
/**
|
|
64
71
|
* Returns a only the property @type {Property['value']} like: `'8px` from: `{ padding: '8px' }`.
|
|
65
72
|
*
|
|
@@ -30,16 +30,18 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
30
30
|
var contextLocalIdentifier = [];
|
|
31
31
|
return {
|
|
32
32
|
ImportDeclaration: function ImportDeclaration(node) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
contextLocalIdentifier.push(local.name);
|
|
41
|
-
}
|
|
33
|
+
var _node$specifiers;
|
|
34
|
+
var buttonGroupIdentifier = (_node$specifiers = node.specifiers) === null || _node$specifiers === void 0 ? void 0 : _node$specifiers.filter(function (spec) {
|
|
35
|
+
if (node.source.value === '@atlaskit/button') {
|
|
36
|
+
var _spec$imported;
|
|
37
|
+
return spec.type === 'ImportSpecifier' && ((_spec$imported = spec.imported) === null || _spec$imported === void 0 ? void 0 : _spec$imported.name) === 'ButtonGroup';
|
|
38
|
+
} else if (node.source.value === '@atlaskit/button/button-group') {
|
|
39
|
+
return spec.type === 'ImportDefaultSpecifier';
|
|
42
40
|
}
|
|
41
|
+
});
|
|
42
|
+
if (buttonGroupIdentifier !== null && buttonGroupIdentifier !== void 0 && buttonGroupIdentifier.length) {
|
|
43
|
+
var local = buttonGroupIdentifier[0].local;
|
|
44
|
+
contextLocalIdentifier.push(local.name);
|
|
43
45
|
}
|
|
44
46
|
},
|
|
45
47
|
JSXElement: function JSXElement(node) {
|
|
@@ -27,6 +27,11 @@ var isValidCssPropertiesToTransform = exports.isValidCssPropertiesToTransform =
|
|
|
27
27
|
if (!ast.Object.isFlat(cssObjectExpression)) {
|
|
28
28
|
return false;
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
// `use-primitives` should not report on empty style objects. See: https://product-fabric.atlassian.net/browse/DSP-16520
|
|
32
|
+
if (ast.Object.getEntries(cssObjectExpression).length === 0) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
30
35
|
var _convertASTObjectExpr = (0, _convertAstObjectExpressionToJsObject.convertASTObjectExpressionToJSObject)(cssObjectExpression),
|
|
31
36
|
unsupported = _convertASTObjectExpr.unsupported,
|
|
32
37
|
cssObject = (0, _objectWithoutProperties2.default)(_convertASTObjectExpr, _excluded);
|
|
@@ -48,12 +48,19 @@ const ASTObjectExpression = {
|
|
|
48
48
|
return [fixer.remove(entry)];
|
|
49
49
|
},
|
|
50
50
|
/**
|
|
51
|
-
* Returns
|
|
51
|
+
* Returns only the property @type {Property['key']} like: `padding` from: `{ padding: '8px' }`.
|
|
52
|
+
* If you want the key/value pair, use `getEntryByPropertyName`.
|
|
52
53
|
*/
|
|
53
54
|
getProperty(node, name) {
|
|
54
55
|
var _ASTObjectExpression$;
|
|
55
56
|
return (_ASTObjectExpression$ = ASTObjectExpression.getEntryByPropertyName(node, name)) === null || _ASTObjectExpression$ === void 0 ? void 0 : _ASTObjectExpression$.key;
|
|
56
57
|
},
|
|
58
|
+
/**
|
|
59
|
+
* Gets the array of key/value pairs in an ObjectExpression.
|
|
60
|
+
*/
|
|
61
|
+
getEntries(node) {
|
|
62
|
+
return node.properties;
|
|
63
|
+
},
|
|
57
64
|
/**
|
|
58
65
|
* Returns a only the property @type {Property['value']} like: `'8px` from: `{ padding: '8px' }`.
|
|
59
66
|
*
|
|
@@ -24,16 +24,20 @@ const rule = createLintRule({
|
|
|
24
24
|
const contextLocalIdentifier = [];
|
|
25
25
|
return {
|
|
26
26
|
ImportDeclaration(node) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
contextLocalIdentifier.push(local.name);
|
|
35
|
-
}
|
|
27
|
+
var _node$specifiers;
|
|
28
|
+
const buttonGroupIdentifier = (_node$specifiers = node.specifiers) === null || _node$specifiers === void 0 ? void 0 : _node$specifiers.filter(spec => {
|
|
29
|
+
if (node.source.value === '@atlaskit/button') {
|
|
30
|
+
var _spec$imported;
|
|
31
|
+
return spec.type === 'ImportSpecifier' && ((_spec$imported = spec.imported) === null || _spec$imported === void 0 ? void 0 : _spec$imported.name) === 'ButtonGroup';
|
|
32
|
+
} else if (node.source.value === '@atlaskit/button/button-group') {
|
|
33
|
+
return spec.type === 'ImportDefaultSpecifier';
|
|
36
34
|
}
|
|
35
|
+
});
|
|
36
|
+
if (buttonGroupIdentifier !== null && buttonGroupIdentifier !== void 0 && buttonGroupIdentifier.length) {
|
|
37
|
+
const {
|
|
38
|
+
local
|
|
39
|
+
} = buttonGroupIdentifier[0];
|
|
40
|
+
contextLocalIdentifier.push(local.name);
|
|
37
41
|
}
|
|
38
42
|
},
|
|
39
43
|
JSXElement(node) {
|
|
@@ -14,6 +14,11 @@ export const isValidCssPropertiesToTransform = (node, config) => {
|
|
|
14
14
|
if (!ast.Object.isFlat(cssObjectExpression)) {
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
// `use-primitives` should not report on empty style objects. See: https://product-fabric.atlassian.net/browse/DSP-16520
|
|
19
|
+
if (ast.Object.getEntries(cssObjectExpression).length === 0) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
17
22
|
const {
|
|
18
23
|
unsupported,
|
|
19
24
|
...cssObject
|
|
@@ -48,12 +48,19 @@ var ASTObjectExpression = {
|
|
|
48
48
|
return [fixer.remove(entry)];
|
|
49
49
|
},
|
|
50
50
|
/**
|
|
51
|
-
* Returns
|
|
51
|
+
* Returns only the property @type {Property['key']} like: `padding` from: `{ padding: '8px' }`.
|
|
52
|
+
* If you want the key/value pair, use `getEntryByPropertyName`.
|
|
52
53
|
*/
|
|
53
54
|
getProperty: function getProperty(node, name) {
|
|
54
55
|
var _ASTObjectExpression$;
|
|
55
56
|
return (_ASTObjectExpression$ = ASTObjectExpression.getEntryByPropertyName(node, name)) === null || _ASTObjectExpression$ === void 0 ? void 0 : _ASTObjectExpression$.key;
|
|
56
57
|
},
|
|
58
|
+
/**
|
|
59
|
+
* Gets the array of key/value pairs in an ObjectExpression.
|
|
60
|
+
*/
|
|
61
|
+
getEntries: function getEntries(node) {
|
|
62
|
+
return node.properties;
|
|
63
|
+
},
|
|
57
64
|
/**
|
|
58
65
|
* Returns a only the property @type {Property['value']} like: `'8px` from: `{ padding: '8px' }`.
|
|
59
66
|
*
|
|
@@ -24,16 +24,18 @@ var rule = createLintRule({
|
|
|
24
24
|
var contextLocalIdentifier = [];
|
|
25
25
|
return {
|
|
26
26
|
ImportDeclaration: function ImportDeclaration(node) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
contextLocalIdentifier.push(local.name);
|
|
35
|
-
}
|
|
27
|
+
var _node$specifiers;
|
|
28
|
+
var buttonGroupIdentifier = (_node$specifiers = node.specifiers) === null || _node$specifiers === void 0 ? void 0 : _node$specifiers.filter(function (spec) {
|
|
29
|
+
if (node.source.value === '@atlaskit/button') {
|
|
30
|
+
var _spec$imported;
|
|
31
|
+
return spec.type === 'ImportSpecifier' && ((_spec$imported = spec.imported) === null || _spec$imported === void 0 ? void 0 : _spec$imported.name) === 'ButtonGroup';
|
|
32
|
+
} else if (node.source.value === '@atlaskit/button/button-group') {
|
|
33
|
+
return spec.type === 'ImportDefaultSpecifier';
|
|
36
34
|
}
|
|
35
|
+
});
|
|
36
|
+
if (buttonGroupIdentifier !== null && buttonGroupIdentifier !== void 0 && buttonGroupIdentifier.length) {
|
|
37
|
+
var local = buttonGroupIdentifier[0].local;
|
|
38
|
+
contextLocalIdentifier.push(local.name);
|
|
37
39
|
}
|
|
38
40
|
},
|
|
39
41
|
JSXElement: function JSXElement(node) {
|
|
@@ -17,6 +17,11 @@ export var isValidCssPropertiesToTransform = function isValidCssPropertiesToTran
|
|
|
17
17
|
if (!ast.Object.isFlat(cssObjectExpression)) {
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
// `use-primitives` should not report on empty style objects. See: https://product-fabric.atlassian.net/browse/DSP-16520
|
|
22
|
+
if (ast.Object.getEntries(cssObjectExpression).length === 0) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
20
25
|
var _convertASTObjectExpr = convertASTObjectExpressionToJSObject(cssObjectExpression),
|
|
21
26
|
unsupported = _convertASTObjectExpr.unsupported,
|
|
22
27
|
cssObject = _objectWithoutProperties(_convertASTObjectExpr, _excluded);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { ObjectExpression, Property } from 'eslint-codemod-utils';
|
|
2
|
+
import { ObjectExpression, Property, SpreadElement } from 'eslint-codemod-utils';
|
|
3
3
|
declare const ASTObjectExpression: {
|
|
4
4
|
/**
|
|
5
5
|
* Returns `true` if an object contains a property with the specified name, `false` otherwise.
|
|
@@ -19,9 +19,14 @@ declare const ASTObjectExpression: {
|
|
|
19
19
|
getEntryByPropertyName(node: ObjectExpression, name: string): Property | undefined;
|
|
20
20
|
deleteEntry(node: ObjectExpression, name: string, fixer: Rule.RuleFixer): Rule.Fix[];
|
|
21
21
|
/**
|
|
22
|
-
* Returns
|
|
22
|
+
* Returns only the property @type {Property['key']} like: `padding` from: `{ padding: '8px' }`.
|
|
23
|
+
* If you want the key/value pair, use `getEntryByPropertyName`.
|
|
23
24
|
*/
|
|
24
25
|
getProperty(node: ObjectExpression, name: string): Property['key'] | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the array of key/value pairs in an ObjectExpression.
|
|
28
|
+
*/
|
|
29
|
+
getEntries(node: ObjectExpression): (Property | SpreadElement)[];
|
|
25
30
|
/**
|
|
26
31
|
* Returns a only the property @type {Property['value']} like: `'8px` from: `{ padding: '8px' }`.
|
|
27
32
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { ObjectExpression, Property } from 'eslint-codemod-utils';
|
|
2
|
+
import { ObjectExpression, Property, SpreadElement } from 'eslint-codemod-utils';
|
|
3
3
|
declare const ASTObjectExpression: {
|
|
4
4
|
/**
|
|
5
5
|
* Returns `true` if an object contains a property with the specified name, `false` otherwise.
|
|
@@ -19,9 +19,14 @@ declare const ASTObjectExpression: {
|
|
|
19
19
|
getEntryByPropertyName(node: ObjectExpression, name: string): Property | undefined;
|
|
20
20
|
deleteEntry(node: ObjectExpression, name: string, fixer: Rule.RuleFixer): Rule.Fix[];
|
|
21
21
|
/**
|
|
22
|
-
* Returns
|
|
22
|
+
* Returns only the property @type {Property['key']} like: `padding` from: `{ padding: '8px' }`.
|
|
23
|
+
* If you want the key/value pair, use `getEntryByPropertyName`.
|
|
23
24
|
*/
|
|
24
25
|
getProperty(node: ObjectExpression, name: string): Property['key'] | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the array of key/value pairs in an ObjectExpression.
|
|
28
|
+
*/
|
|
29
|
+
getEntries(node: ObjectExpression): (Property | SpreadElement)[];
|
|
25
30
|
/**
|
|
26
31
|
* Returns a only the property @type {Property['value']} like: `'8px` from: `{ padding: '8px' }`.
|
|
27
32
|
*
|
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.25.
|
|
4
|
+
"version": "8.25.2",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"registry": "https://registry.npmjs.org/"
|