@atlaskit/eslint-plugin-design-system 8.25.1 → 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 CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 8.25.1
4
10
 
5
11
  ### Patch Changes
@@ -54,12 +54,19 @@ var ASTObjectExpression = exports.Object = {
54
54
  return [fixer.remove(entry)];
55
55
  },
56
56
  /**
57
- * Returns a only the property @type {Property['key']} like: `padding` from: `{ padding: '8px' }`.
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
  *
@@ -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 a only the property @type {Property['key']} like: `padding` from: `{ padding: '8px' }`.
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
  *
@@ -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 a only the property @type {Property['key']} like: `padding` from: `{ padding: '8px' }`.
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
  *
@@ -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 a only the property @type {Property['key']} like: `padding` from: `{ padding: '8px' }`.
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 a only the property @type {Property['key']} like: `padding` from: `{ padding: '8px' }`.
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.1",
4
+ "version": "8.25.2",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
7
7
  "registry": "https://registry.npmjs.org/"