@atlaskit/eslint-plugin-design-system 10.3.1 → 10.4.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -0
  3. package/constellation/index/usage.mdx +1 -0
  4. package/constellation/use-latest-xcss-syntax/usage.mdx +33 -0
  5. package/dist/cjs/presets/all.codegen.js +2 -1
  6. package/dist/cjs/presets/recommended.codegen.js +2 -1
  7. package/dist/cjs/rules/index.codegen.js +3 -1
  8. package/dist/cjs/rules/use-latest-xcss-syntax/index.js +35 -0
  9. package/dist/cjs/rules/use-latest-xcss-syntax/transformers/index.js +12 -0
  10. package/dist/cjs/rules/use-latest-xcss-syntax/transformers/style-property/index.js +105 -0
  11. package/dist/cjs/rules/use-latest-xcss-syntax/transformers/style-property/style-map.js +7 -0
  12. package/dist/cjs/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +13 -0
  13. package/dist/cjs/rules/use-latest-xcss-syntax/utils/index.js +12 -0
  14. package/dist/cjs/rules/use-latest-xcss-syntax/utils/is-string-or-number.js +9 -0
  15. package/dist/cjs/rules/use-tokens-typography/transformers/style-object.js +6 -0
  16. package/dist/es2019/presets/all.codegen.js +2 -1
  17. package/dist/es2019/presets/recommended.codegen.js +2 -1
  18. package/dist/es2019/rules/index.codegen.js +3 -1
  19. package/dist/es2019/rules/use-latest-xcss-syntax/index.js +27 -0
  20. package/dist/es2019/rules/use-latest-xcss-syntax/transformers/index.js +1 -0
  21. package/dist/es2019/rules/use-latest-xcss-syntax/transformers/style-property/index.js +99 -0
  22. package/dist/es2019/rules/use-latest-xcss-syntax/transformers/style-property/style-map.js +1 -0
  23. package/dist/es2019/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +7 -0
  24. package/dist/es2019/rules/use-latest-xcss-syntax/utils/index.js +1 -0
  25. package/dist/es2019/rules/use-latest-xcss-syntax/utils/is-string-or-number.js +3 -0
  26. package/dist/es2019/rules/use-tokens-typography/transformers/style-object.js +7 -1
  27. package/dist/esm/presets/all.codegen.js +2 -1
  28. package/dist/esm/presets/recommended.codegen.js +2 -1
  29. package/dist/esm/rules/index.codegen.js +3 -1
  30. package/dist/esm/rules/use-latest-xcss-syntax/index.js +29 -0
  31. package/dist/esm/rules/use-latest-xcss-syntax/transformers/index.js +1 -0
  32. package/dist/esm/rules/use-latest-xcss-syntax/transformers/style-property/index.js +95 -0
  33. package/dist/esm/rules/use-latest-xcss-syntax/transformers/style-property/style-map.js +1 -0
  34. package/dist/esm/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +7 -0
  35. package/dist/esm/rules/use-latest-xcss-syntax/utils/index.js +1 -0
  36. package/dist/esm/rules/use-latest-xcss-syntax/utils/is-string-or-number.js +3 -0
  37. package/dist/esm/rules/use-tokens-typography/transformers/style-object.js +6 -0
  38. package/dist/types/index.codegen.d.ts +2 -0
  39. package/dist/types/presets/all.codegen.d.ts +2 -1
  40. package/dist/types/presets/recommended.codegen.d.ts +2 -1
  41. package/dist/types/rules/index.codegen.d.ts +1 -0
  42. package/dist/types/rules/use-latest-xcss-syntax/index.d.ts +4 -0
  43. package/dist/types/rules/use-latest-xcss-syntax/transformers/index.d.ts +1 -0
  44. package/dist/types/rules/use-latest-xcss-syntax/transformers/style-property/index.d.ts +18 -0
  45. package/dist/types/rules/use-latest-xcss-syntax/transformers/style-property/style-map.d.ts +1 -0
  46. package/dist/types/rules/use-latest-xcss-syntax/transformers/style-property/supported.d.ts +6 -0
  47. package/dist/types/rules/use-latest-xcss-syntax/utils/index.d.ts +1 -0
  48. package/dist/types/rules/use-latest-xcss-syntax/utils/is-string-or-number.d.ts +1 -0
  49. package/dist/types-ts4.5/index.codegen.d.ts +2 -0
  50. package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
  51. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +2 -1
  52. package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
  53. package/dist/types-ts4.5/rules/use-latest-xcss-syntax/index.d.ts +4 -0
  54. package/dist/types-ts4.5/rules/use-latest-xcss-syntax/transformers/index.d.ts +1 -0
  55. package/dist/types-ts4.5/rules/use-latest-xcss-syntax/transformers/style-property/index.d.ts +18 -0
  56. package/dist/types-ts4.5/rules/use-latest-xcss-syntax/transformers/style-property/style-map.d.ts +1 -0
  57. package/dist/types-ts4.5/rules/use-latest-xcss-syntax/transformers/style-property/supported.d.ts +6 -0
  58. package/dist/types-ts4.5/rules/use-latest-xcss-syntax/utils/index.d.ts +1 -0
  59. package/dist/types-ts4.5/rules/use-latest-xcss-syntax/utils/is-string-or-number.d.ts +1 -0
  60. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 10.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#103215](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103215)
8
+ [`1108a9b46be2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1108a9b46be2) -
9
+ Fixed an issue with the `use-tokens-typography` rule where font family properties that were
10
+ already using a token could be misinterpreted and cause the font family property to be removed.
11
+
12
+ ## 10.4.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#103102](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103102)
17
+ [`3c920b0719af`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3c920b0719af) -
18
+ Add `use-latest-xcss-syntax` eslint rule.
19
+
3
20
  ## 10.3.1
4
21
 
5
22
  ### Patch Changes
package/README.md CHANGED
@@ -79,6 +79,7 @@ module.exports = {
79
79
  | <a href="./src/rules/use-heading/README.md">use-heading</a> | Encourage the usage of heading components. | | Yes | Yes |
80
80
  | <a href="./src/rules/use-heading-level-in-spotlight-card/README.md">use-heading-level-in-spotlight-card</a> | Inform developers of eventual requirement of `headingLevel` prop in `SpotlightCard` component. The heading level should be the appropriate level according to the surrounding context. | Yes | Yes | |
81
81
  | <a href="./src/rules/use-href-in-link-item/README.md">use-href-in-link-item</a> | Inform developers of eventual requirement of `href` prop in `LinkItem` component. Elements with a `link` role require an `href` attribute for users to properly navigate, particularly those using assistive technologies. If no valid `href` is required for your use case, consider using a `ButtonItem` instead. | Yes | Yes | Yes |
82
+ | <a href="./src/rules/use-latest-xcss-syntax/README.md">use-latest-xcss-syntax</a> | Enforces usage of space design tokens rather than hard-coded values in xcss. | Yes | Yes | |
82
83
  | <a href="./src/rules/use-popup-label/README.md">use-popup-label</a> | Encourages to provide accessible name for Atlassian Design System Popup component. | Yes | | Yes |
83
84
  | <a href="./src/rules/use-primitives/README.md">use-primitives</a> | Encourage the usage of primitives components. | | Yes | Yes |
84
85
  | <a href="./src/rules/use-primitives-text/README.md">use-primitives-text</a> | Encourage the usage of text components. | | Yes | Yes |
@@ -42,6 +42,7 @@ This plugin contains rules that should be used when working with the
42
42
  | <a href="use-heading/usage">use-heading</a> | Encourage the usage of heading components. | | Yes | Yes |
43
43
  | <a href="use-heading-level-in-spotlight-card/usage">use-heading-level-in-spotlight-card</a> | Inform developers of eventual requirement of `headingLevel` prop in `SpotlightCard` component. The heading level should be the appropriate level according to the surrounding context. | Yes | Yes | |
44
44
  | <a href="use-href-in-link-item/usage">use-href-in-link-item</a> | Inform developers of eventual requirement of `href` prop in `LinkItem` component. Elements with a `link` role require an `href` attribute for users to properly navigate, particularly those using assistive technologies. If no valid `href` is required for your use case, consider using a `ButtonItem` instead. | Yes | Yes | Yes |
45
+ | <a href="use-latest-xcss-syntax/usage">use-latest-xcss-syntax</a> | Enforces usage of space design tokens rather than hard-coded values in xcss. | Yes | Yes | |
45
46
  | <a href="use-popup-label/usage">use-popup-label</a> | Encourages to provide accessible name for Atlassian Design System Popup component. | Yes | | Yes |
46
47
  | <a href="use-primitives/usage">use-primitives</a> | Encourage the usage of primitives components. | | Yes | Yes |
47
48
  | <a href="use-primitives-text/usage">use-primitives-text</a> | Encourage the usage of text components. | | Yes | Yes |
@@ -0,0 +1,33 @@
1
+ # use-latest-xcss-syntax
2
+
3
+ ## Description
4
+
5
+ Soon, non-token values for the following properties will raise TypeScript errors. This rule prevents
6
+ new violations from being written until blockers are resolved.
7
+
8
+ ## Examples
9
+
10
+ ### Incorrect
11
+
12
+ ```jsx
13
+ const someStyles = xcss({
14
+ margin: '8px';
15
+ ^^^^^
16
+ })
17
+ ```
18
+
19
+ ### Correct
20
+
21
+ ```jsx
22
+ const someStyles = xcss({
23
+ margin: 'space.100';
24
+ })
25
+ ```
26
+
27
+ See the list of available space tokens on the
28
+ [ADS website](https://atlassian.design/foundations/spacing#space-tokens).
29
+
30
+ For Atlassians:
31
+
32
+ - See [go/xcss-spacing](https://go.atlassian.com/xcss-spacing) for context on why this is
33
+ happening, and how you can prepare.
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  /**
8
8
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
9
- * @codegen <<SignedSource::0be7639a95bf4c9bbfe00154d8193477>>
9
+ * @codegen <<SignedSource::8453f9be2d12c65323a70743b71f7474>>
10
10
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
11
11
  */
12
12
  var _default = exports.default = {
@@ -42,6 +42,7 @@ var _default = exports.default = {
42
42
  '@atlaskit/design-system/use-heading': 'warn',
43
43
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
44
44
  '@atlaskit/design-system/use-href-in-link-item': 'warn',
45
+ '@atlaskit/design-system/use-latest-xcss-syntax': 'warn',
45
46
  '@atlaskit/design-system/use-popup-label': 'warn',
46
47
  '@atlaskit/design-system/use-primitives': 'warn',
47
48
  '@atlaskit/design-system/use-primitives-text': 'warn',
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  /**
8
8
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
9
- * @codegen <<SignedSource::73a3666b244b58cc221eebcda071161d>>
9
+ * @codegen <<SignedSource::c67c53656bcdaedb72953c8026a01c24>>
10
10
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
11
11
  */
12
12
  var _default = exports.default = {
@@ -32,6 +32,7 @@ var _default = exports.default = {
32
32
  '@atlaskit/design-system/use-drawer-label': 'warn',
33
33
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
34
34
  '@atlaskit/design-system/use-href-in-link-item': 'warn',
35
+ '@atlaskit/design-system/use-latest-xcss-syntax': 'warn',
35
36
  '@atlaskit/design-system/use-popup-label': 'warn',
36
37
  '@atlaskit/design-system/use-visually-hidden': 'error'
37
38
  }
@@ -35,6 +35,7 @@ var _useDrawerLabel = _interopRequireDefault(require("./use-drawer-label"));
35
35
  var _useHeading = _interopRequireDefault(require("./use-heading"));
36
36
  var _useHeadingLevelInSpotlightCard = _interopRequireDefault(require("./use-heading-level-in-spotlight-card"));
37
37
  var _useHrefInLinkItem = _interopRequireDefault(require("./use-href-in-link-item"));
38
+ var _useLatestXcssSyntax = _interopRequireDefault(require("./use-latest-xcss-syntax"));
38
39
  var _usePopupLabel = _interopRequireDefault(require("./use-popup-label"));
39
40
  var _usePrimitives = _interopRequireDefault(require("./use-primitives"));
40
41
  var _usePrimitivesText = _interopRequireDefault(require("./use-primitives-text"));
@@ -43,7 +44,7 @@ var _useTokensTypography = _interopRequireDefault(require("./use-tokens-typograp
43
44
  var _useVisuallyHidden = _interopRequireDefault(require("./use-visually-hidden"));
44
45
  /**
45
46
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
46
- * @codegen <<SignedSource::9b934590b0ff7880e962fa4dd73bdb0b>>
47
+ * @codegen <<SignedSource::5eacfe26cc2ae11b81dfad5719b90959>>
47
48
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
48
49
  */
49
50
  var _default = exports.default = {
@@ -77,6 +78,7 @@ var _default = exports.default = {
77
78
  'use-heading': _useHeading.default,
78
79
  'use-heading-level-in-spotlight-card': _useHeadingLevelInSpotlightCard.default,
79
80
  'use-href-in-link-item': _useHrefInLinkItem.default,
81
+ 'use-latest-xcss-syntax': _useLatestXcssSyntax.default,
80
82
  'use-popup-label': _usePopupLabel.default,
81
83
  'use-primitives': _usePrimitives.default,
82
84
  'use-primitives-text': _usePrimitivesText.default,
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.noRawSpacingValues = exports.default = void 0;
7
+ var _createRule = require("../utils/create-rule");
8
+ var _transformers = require("./transformers");
9
+ var noRawSpacingValues = exports.noRawSpacingValues = "Don't use non-token values in padding or margin. There is ongoing work to make this a TypeScript error. Once that happens, you will have to delete/refactor anyway. Atlassians: See https://go.atlassian.com/xcss-spacing for details.";
10
+ var rule = (0, _createRule.createLintRule)({
11
+ meta: {
12
+ name: 'use-latest-xcss-syntax',
13
+ type: 'problem',
14
+ fixable: 'code',
15
+ hasSuggestions: false,
16
+ docs: {
17
+ description: 'Enforces usage of space design tokens rather than hard-coded values in xcss.',
18
+ recommended: true,
19
+ severity: 'warn'
20
+ },
21
+ messages: {
22
+ noRawSpacingValues: noRawSpacingValues
23
+ }
24
+ },
25
+ create: function create(context) {
26
+ return {
27
+ 'CallExpression[callee.name="xcss"] ObjectExpression Property': function CallExpressionCalleeNameXcssObjectExpressionProperty(node) {
28
+ return _transformers.StyleProperty.lint(node, {
29
+ context: context
30
+ });
31
+ }
32
+ };
33
+ }
34
+ });
35
+ var _default = exports.default = rule;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "StyleProperty", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _styleProperty.StyleProperty;
10
+ }
11
+ });
12
+ var _styleProperty = require("./style-property");
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.StyleProperty = void 0;
9
+ var _eslintCodemodUtils = require("eslint-codemod-utils");
10
+ var ast = _interopRequireWildcard(require("../../../../ast-nodes"));
11
+ var _styleMap = require("./style-map");
12
+ var _supported = _interopRequireDefault(require("./supported"));
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
+ /* eslint-disable @repo/internal/react/require-jsdoc */
16
+
17
+ var messageId = 'noRawSpacingValues';
18
+ var StyleProperty = exports.StyleProperty = {
19
+ lint: function lint(node, _ref) {
20
+ var context = _ref.context;
21
+ var _StyleProperty$_check = StyleProperty._check(node, {
22
+ context: context
23
+ }),
24
+ success = _StyleProperty$_check.success,
25
+ ref = _StyleProperty$_check.ref;
26
+ if (!success) {
27
+ return;
28
+ }
29
+ context.report({
30
+ node: ref,
31
+ messageId: messageId
32
+ });
33
+ },
34
+ _check: function _check(node, _ref2) {
35
+ var context = _ref2.context;
36
+ if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'Property')) {
37
+ return {
38
+ success: false,
39
+ ref: undefined
40
+ };
41
+ }
42
+ var importDeclarations = ast.Root.findImportsByModule(context.sourceCode.ast.body, '@atlaskit/primitives');
43
+ var isXcssImported = importDeclarations.some(function (importDeclaration) {
44
+ return ast.Import.containsNamedSpecifier(importDeclaration, 'xcss');
45
+ });
46
+ if (!isXcssImported) {
47
+ return {
48
+ success: false,
49
+ ref: undefined
50
+ };
51
+ }
52
+
53
+ /**
54
+ * Currently, we support values like:
55
+ * ```
56
+ * xcss({
57
+ * margin: '8px', // value.type is Literal
58
+ * })
59
+ * ```
60
+ *
61
+ * More complex code, like:
62
+ * ```
63
+ * xcss({
64
+ * margin: condition ? 'space.100' : 'space.200',
65
+ * })
66
+ * ```
67
+ * is too difficult to lint
68
+ */
69
+ if (!(0, _eslintCodemodUtils.isNodeOfType)(node.value, 'Literal')) {
70
+ return {
71
+ success: false,
72
+ ref: undefined
73
+ };
74
+ }
75
+ var _ast$ObjectEntry$getP = ast.ObjectEntry.getProperty(node),
76
+ property = _ast$ObjectEntry$getP.value;
77
+
78
+ // Bail if the property is not `padding`, `margin`, etc
79
+ if (!property || !_styleMap.styleMap.includes(property)) {
80
+ return {
81
+ success: false,
82
+ ref: undefined
83
+ };
84
+ }
85
+ var value = ast.ObjectEntry.getValue(node);
86
+ if (typeof value !== 'string') {
87
+ return {
88
+ success: false,
89
+ ref: undefined
90
+ };
91
+ }
92
+
93
+ // There are valid values to ignore, such as tokens, or `margin: auto`
94
+ if (_supported.default.values.ignore.includes(value)) {
95
+ return {
96
+ success: false,
97
+ ref: undefined
98
+ };
99
+ }
100
+ return {
101
+ success: true,
102
+ ref: node
103
+ };
104
+ }
105
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.styleMap = void 0;
7
+ var styleMap = exports.styleMap = ['margin-block-end', 'margin-block-start', 'margin-block', 'margin-bottom', 'margin-inline-end', 'margin-inline-start', 'margin-inline', 'margin-left', 'margin-right', 'margin-top', 'padding-block-end', 'padding-block-start', 'padding-block', 'padding-bottom', 'padding-inline-end', 'padding-inline-start', 'padding-inline', 'padding-left', 'padding-right', 'padding-top', 'margin', 'marginBlock', 'marginBlockEnd', 'marginBlockStart', 'marginBottom', 'marginInline', 'marginInlineEnd', 'marginInlineStart', 'marginLeft', 'marginRight', 'marginTop', 'padding', 'paddingBlock', 'paddingBlockEnd', 'paddingBlockStart', 'paddingBottom', 'paddingInline', 'paddingInlineEnd', 'paddingInlineStart', 'paddingLeft', 'paddingRight', 'paddingTop'];
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = exports.default = {
8
+ values: {
9
+ ignore: ['auto', 'initial', 'inherit', 'unset', 'revert', 'revert-layer',
10
+ // Currently the DST opinion is that 0 is valid. It doesn't need to be converted to `space.0`
11
+ '0', 'space.negative.025', 'space.negative.050', 'space.negative.075', 'space.negative.100', 'space.negative.150', 'space.negative.200', 'space.negative.250', 'space.negative.300', 'space.negative.400', 'space.025', 'space.050', 'space.075', 'space.100', 'space.150', 'space.200', 'space.250', 'space.300', 'space.400', 'space.500', 'space.600', 'space.800', 'space.1000']
12
+ }
13
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "isStringOrNumber", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _isStringOrNumber.isStringOrNumber;
10
+ }
11
+ });
12
+ var _isStringOrNumber = require("./is-string-or-number");
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isStringOrNumber = void 0;
7
+ var isStringOrNumber = exports.isStringOrNumber = function isStringOrNumber(value) {
8
+ return typeof value === 'string' || typeof value === 'number';
9
+ };
@@ -95,6 +95,12 @@ var StyleObject = exports.StyleObject = {
95
95
  var fontFamilyNode = _astNodes.Object.getEntryByPropertyName(node, 'fontFamily');
96
96
  var fontFamilyRaw = fontFamilyNode && (0, _utils.getValueForPropertyNode)(fontFamilyNode, context);
97
97
  var fontFamilyValue = fontFamilyRaw && (0, _utils.normaliseValue)('fontFamily', fontFamilyRaw) || undefined;
98
+
99
+ // If font family is already a token, we remove and re-add it
100
+ // Only need to do this for non-default font stacks as the defaults can be safely removed
101
+ if (fontFamilyValue && fontFamilyValue.includes('font.family.') && !(fontFamilyValue.includes('font.family.heading') || fontFamilyValue.includes('font.family.body'))) {
102
+ fontFamilyValue = undefined;
103
+ }
98
104
  var fontFamilyToAdd;
99
105
  // If font family uses the Charlie font we can't replace; exit
100
106
  if (fontFamilyValue) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::0be7639a95bf4c9bbfe00154d8193477>>
3
+ * @codegen <<SignedSource::8453f9be2d12c65323a70743b71f7474>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  export default {
@@ -36,6 +36,7 @@ export default {
36
36
  '@atlaskit/design-system/use-heading': 'warn',
37
37
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
38
38
  '@atlaskit/design-system/use-href-in-link-item': 'warn',
39
+ '@atlaskit/design-system/use-latest-xcss-syntax': 'warn',
39
40
  '@atlaskit/design-system/use-popup-label': 'warn',
40
41
  '@atlaskit/design-system/use-primitives': 'warn',
41
42
  '@atlaskit/design-system/use-primitives-text': 'warn',
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::73a3666b244b58cc221eebcda071161d>>
3
+ * @codegen <<SignedSource::c67c53656bcdaedb72953c8026a01c24>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  export default {
@@ -26,6 +26,7 @@ export default {
26
26
  '@atlaskit/design-system/use-drawer-label': 'warn',
27
27
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
28
28
  '@atlaskit/design-system/use-href-in-link-item': 'warn',
29
+ '@atlaskit/design-system/use-latest-xcss-syntax': 'warn',
29
30
  '@atlaskit/design-system/use-popup-label': 'warn',
30
31
  '@atlaskit/design-system/use-visually-hidden': 'error'
31
32
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::9b934590b0ff7880e962fa4dd73bdb0b>>
3
+ * @codegen <<SignedSource::5eacfe26cc2ae11b81dfad5719b90959>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  import consistentCssPropUsage from './consistent-css-prop-usage';
@@ -33,6 +33,7 @@ import useDrawerLabel from './use-drawer-label';
33
33
  import useHeading from './use-heading';
34
34
  import useHeadingLevelInSpotlightCard from './use-heading-level-in-spotlight-card';
35
35
  import useHrefInLinkItem from './use-href-in-link-item';
36
+ import useLatestXcssSyntax from './use-latest-xcss-syntax';
36
37
  import usePopupLabel from './use-popup-label';
37
38
  import usePrimitives from './use-primitives';
38
39
  import usePrimitivesText from './use-primitives-text';
@@ -70,6 +71,7 @@ export default {
70
71
  'use-heading': useHeading,
71
72
  'use-heading-level-in-spotlight-card': useHeadingLevelInSpotlightCard,
72
73
  'use-href-in-link-item': useHrefInLinkItem,
74
+ 'use-latest-xcss-syntax': useLatestXcssSyntax,
73
75
  'use-popup-label': usePopupLabel,
74
76
  'use-primitives': usePrimitives,
75
77
  'use-primitives-text': usePrimitivesText,
@@ -0,0 +1,27 @@
1
+ import { createLintRule } from '../utils/create-rule';
2
+ import { StyleProperty } from './transformers';
3
+ export const noRawSpacingValues = `Don't use non-token values in padding or margin. There is ongoing work to make this a TypeScript error. Once that happens, you will have to delete/refactor anyway. Atlassians: See https://go.atlassian.com/xcss-spacing for details.`;
4
+ const rule = createLintRule({
5
+ meta: {
6
+ name: 'use-latest-xcss-syntax',
7
+ type: 'problem',
8
+ fixable: 'code',
9
+ hasSuggestions: false,
10
+ docs: {
11
+ description: 'Enforces usage of space design tokens rather than hard-coded values in xcss.',
12
+ recommended: true,
13
+ severity: 'warn'
14
+ },
15
+ messages: {
16
+ noRawSpacingValues
17
+ }
18
+ },
19
+ create(context) {
20
+ return {
21
+ 'CallExpression[callee.name="xcss"] ObjectExpression Property': node => StyleProperty.lint(node, {
22
+ context
23
+ })
24
+ };
25
+ }
26
+ });
27
+ export default rule;
@@ -0,0 +1 @@
1
+ export { StyleProperty } from './style-property';
@@ -0,0 +1,99 @@
1
+ /* eslint-disable @repo/internal/react/require-jsdoc */
2
+
3
+ import { isNodeOfType } from 'eslint-codemod-utils';
4
+ import * as ast from '../../../../ast-nodes';
5
+ import { styleMap } from './style-map';
6
+ import supported from './supported';
7
+ const messageId = 'noRawSpacingValues';
8
+ export const StyleProperty = {
9
+ lint(node, {
10
+ context
11
+ }) {
12
+ const {
13
+ success,
14
+ ref
15
+ } = StyleProperty._check(node, {
16
+ context
17
+ });
18
+ if (!success) {
19
+ return;
20
+ }
21
+ context.report({
22
+ node: ref,
23
+ messageId
24
+ });
25
+ },
26
+ _check(node, {
27
+ context
28
+ }) {
29
+ if (!isNodeOfType(node, 'Property')) {
30
+ return {
31
+ success: false,
32
+ ref: undefined
33
+ };
34
+ }
35
+ const importDeclarations = ast.Root.findImportsByModule(context.sourceCode.ast.body, '@atlaskit/primitives');
36
+ const isXcssImported = importDeclarations.some(importDeclaration => {
37
+ return ast.Import.containsNamedSpecifier(importDeclaration, 'xcss');
38
+ });
39
+ if (!isXcssImported) {
40
+ return {
41
+ success: false,
42
+ ref: undefined
43
+ };
44
+ }
45
+
46
+ /**
47
+ * Currently, we support values like:
48
+ * ```
49
+ * xcss({
50
+ * margin: '8px', // value.type is Literal
51
+ * })
52
+ * ```
53
+ *
54
+ * More complex code, like:
55
+ * ```
56
+ * xcss({
57
+ * margin: condition ? 'space.100' : 'space.200',
58
+ * })
59
+ * ```
60
+ * is too difficult to lint
61
+ */
62
+ if (!isNodeOfType(node.value, 'Literal')) {
63
+ return {
64
+ success: false,
65
+ ref: undefined
66
+ };
67
+ }
68
+ const {
69
+ value: property
70
+ } = ast.ObjectEntry.getProperty(node);
71
+
72
+ // Bail if the property is not `padding`, `margin`, etc
73
+ if (!property || !styleMap.includes(property)) {
74
+ return {
75
+ success: false,
76
+ ref: undefined
77
+ };
78
+ }
79
+ const value = ast.ObjectEntry.getValue(node);
80
+ if (typeof value !== 'string') {
81
+ return {
82
+ success: false,
83
+ ref: undefined
84
+ };
85
+ }
86
+
87
+ // There are valid values to ignore, such as tokens, or `margin: auto`
88
+ if (supported.values.ignore.includes(value)) {
89
+ return {
90
+ success: false,
91
+ ref: undefined
92
+ };
93
+ }
94
+ return {
95
+ success: true,
96
+ ref: node
97
+ };
98
+ }
99
+ };
@@ -0,0 +1 @@
1
+ export const styleMap = ['margin-block-end', 'margin-block-start', 'margin-block', 'margin-bottom', 'margin-inline-end', 'margin-inline-start', 'margin-inline', 'margin-left', 'margin-right', 'margin-top', 'padding-block-end', 'padding-block-start', 'padding-block', 'padding-bottom', 'padding-inline-end', 'padding-inline-start', 'padding-inline', 'padding-left', 'padding-right', 'padding-top', 'margin', 'marginBlock', 'marginBlockEnd', 'marginBlockStart', 'marginBottom', 'marginInline', 'marginInlineEnd', 'marginInlineStart', 'marginLeft', 'marginRight', 'marginTop', 'padding', 'paddingBlock', 'paddingBlockEnd', 'paddingBlockStart', 'paddingBottom', 'paddingInline', 'paddingInlineEnd', 'paddingInlineStart', 'paddingLeft', 'paddingRight', 'paddingTop'];
@@ -0,0 +1,7 @@
1
+ export default {
2
+ values: {
3
+ ignore: ['auto', 'initial', 'inherit', 'unset', 'revert', 'revert-layer',
4
+ // Currently the DST opinion is that 0 is valid. It doesn't need to be converted to `space.0`
5
+ '0', 'space.negative.025', 'space.negative.050', 'space.negative.075', 'space.negative.100', 'space.negative.150', 'space.negative.200', 'space.negative.250', 'space.negative.300', 'space.negative.400', 'space.025', 'space.050', 'space.075', 'space.100', 'space.150', 'space.200', 'space.250', 'space.300', 'space.400', 'space.500', 'space.600', 'space.800', 'space.1000']
6
+ }
7
+ };
@@ -0,0 +1 @@
1
+ export { isStringOrNumber } from './is-string-or-number';
@@ -0,0 +1,3 @@
1
+ export const isStringOrNumber = value => {
2
+ return typeof value === 'string' || typeof value === 'number';
3
+ };
@@ -88,7 +88,13 @@ export const StyleObject = {
88
88
  // -- Font family --
89
89
  const fontFamilyNode = ASTObject.getEntryByPropertyName(node, 'fontFamily');
90
90
  const fontFamilyRaw = fontFamilyNode && getValueForPropertyNode(fontFamilyNode, context);
91
- const fontFamilyValue = fontFamilyRaw && normaliseValue('fontFamily', fontFamilyRaw) || undefined;
91
+ let fontFamilyValue = fontFamilyRaw && normaliseValue('fontFamily', fontFamilyRaw) || undefined;
92
+
93
+ // If font family is already a token, we remove and re-add it
94
+ // Only need to do this for non-default font stacks as the defaults can be safely removed
95
+ if (fontFamilyValue && fontFamilyValue.includes('font.family.') && !(fontFamilyValue.includes('font.family.heading') || fontFamilyValue.includes('font.family.body'))) {
96
+ fontFamilyValue = undefined;
97
+ }
92
98
  let fontFamilyToAdd;
93
99
  // If font family uses the Charlie font we can't replace; exit
94
100
  if (fontFamilyValue) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::0be7639a95bf4c9bbfe00154d8193477>>
3
+ * @codegen <<SignedSource::8453f9be2d12c65323a70743b71f7474>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  export default {
@@ -36,6 +36,7 @@ export default {
36
36
  '@atlaskit/design-system/use-heading': 'warn',
37
37
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
38
38
  '@atlaskit/design-system/use-href-in-link-item': 'warn',
39
+ '@atlaskit/design-system/use-latest-xcss-syntax': 'warn',
39
40
  '@atlaskit/design-system/use-popup-label': 'warn',
40
41
  '@atlaskit/design-system/use-primitives': 'warn',
41
42
  '@atlaskit/design-system/use-primitives-text': 'warn',
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::73a3666b244b58cc221eebcda071161d>>
3
+ * @codegen <<SignedSource::c67c53656bcdaedb72953c8026a01c24>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  export default {
@@ -26,6 +26,7 @@ export default {
26
26
  '@atlaskit/design-system/use-drawer-label': 'warn',
27
27
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
28
28
  '@atlaskit/design-system/use-href-in-link-item': 'warn',
29
+ '@atlaskit/design-system/use-latest-xcss-syntax': 'warn',
29
30
  '@atlaskit/design-system/use-popup-label': 'warn',
30
31
  '@atlaskit/design-system/use-visually-hidden': 'error'
31
32
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::9b934590b0ff7880e962fa4dd73bdb0b>>
3
+ * @codegen <<SignedSource::5eacfe26cc2ae11b81dfad5719b90959>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  import consistentCssPropUsage from './consistent-css-prop-usage';
@@ -33,6 +33,7 @@ import useDrawerLabel from './use-drawer-label';
33
33
  import useHeading from './use-heading';
34
34
  import useHeadingLevelInSpotlightCard from './use-heading-level-in-spotlight-card';
35
35
  import useHrefInLinkItem from './use-href-in-link-item';
36
+ import useLatestXcssSyntax from './use-latest-xcss-syntax';
36
37
  import usePopupLabel from './use-popup-label';
37
38
  import usePrimitives from './use-primitives';
38
39
  import usePrimitivesText from './use-primitives-text';
@@ -70,6 +71,7 @@ export default {
70
71
  'use-heading': useHeading,
71
72
  'use-heading-level-in-spotlight-card': useHeadingLevelInSpotlightCard,
72
73
  'use-href-in-link-item': useHrefInLinkItem,
74
+ 'use-latest-xcss-syntax': useLatestXcssSyntax,
73
75
  'use-popup-label': usePopupLabel,
74
76
  'use-primitives': usePrimitives,
75
77
  'use-primitives-text': usePrimitivesText,
@@ -0,0 +1,29 @@
1
+ import { createLintRule } from '../utils/create-rule';
2
+ import { StyleProperty } from './transformers';
3
+ export var noRawSpacingValues = "Don't use non-token values in padding or margin. There is ongoing work to make this a TypeScript error. Once that happens, you will have to delete/refactor anyway. Atlassians: See https://go.atlassian.com/xcss-spacing for details.";
4
+ var rule = createLintRule({
5
+ meta: {
6
+ name: 'use-latest-xcss-syntax',
7
+ type: 'problem',
8
+ fixable: 'code',
9
+ hasSuggestions: false,
10
+ docs: {
11
+ description: 'Enforces usage of space design tokens rather than hard-coded values in xcss.',
12
+ recommended: true,
13
+ severity: 'warn'
14
+ },
15
+ messages: {
16
+ noRawSpacingValues: noRawSpacingValues
17
+ }
18
+ },
19
+ create: function create(context) {
20
+ return {
21
+ 'CallExpression[callee.name="xcss"] ObjectExpression Property': function CallExpressionCalleeNameXcssObjectExpressionProperty(node) {
22
+ return StyleProperty.lint(node, {
23
+ context: context
24
+ });
25
+ }
26
+ };
27
+ }
28
+ });
29
+ export default rule;
@@ -0,0 +1 @@
1
+ export { StyleProperty } from './style-property';
@@ -0,0 +1,95 @@
1
+ /* eslint-disable @repo/internal/react/require-jsdoc */
2
+
3
+ import { isNodeOfType } from 'eslint-codemod-utils';
4
+ import * as ast from '../../../../ast-nodes';
5
+ import { styleMap } from './style-map';
6
+ import supported from './supported';
7
+ var messageId = 'noRawSpacingValues';
8
+ export var StyleProperty = {
9
+ lint: function lint(node, _ref) {
10
+ var context = _ref.context;
11
+ var _StyleProperty$_check = StyleProperty._check(node, {
12
+ context: context
13
+ }),
14
+ success = _StyleProperty$_check.success,
15
+ ref = _StyleProperty$_check.ref;
16
+ if (!success) {
17
+ return;
18
+ }
19
+ context.report({
20
+ node: ref,
21
+ messageId: messageId
22
+ });
23
+ },
24
+ _check: function _check(node, _ref2) {
25
+ var context = _ref2.context;
26
+ if (!isNodeOfType(node, 'Property')) {
27
+ return {
28
+ success: false,
29
+ ref: undefined
30
+ };
31
+ }
32
+ var importDeclarations = ast.Root.findImportsByModule(context.sourceCode.ast.body, '@atlaskit/primitives');
33
+ var isXcssImported = importDeclarations.some(function (importDeclaration) {
34
+ return ast.Import.containsNamedSpecifier(importDeclaration, 'xcss');
35
+ });
36
+ if (!isXcssImported) {
37
+ return {
38
+ success: false,
39
+ ref: undefined
40
+ };
41
+ }
42
+
43
+ /**
44
+ * Currently, we support values like:
45
+ * ```
46
+ * xcss({
47
+ * margin: '8px', // value.type is Literal
48
+ * })
49
+ * ```
50
+ *
51
+ * More complex code, like:
52
+ * ```
53
+ * xcss({
54
+ * margin: condition ? 'space.100' : 'space.200',
55
+ * })
56
+ * ```
57
+ * is too difficult to lint
58
+ */
59
+ if (!isNodeOfType(node.value, 'Literal')) {
60
+ return {
61
+ success: false,
62
+ ref: undefined
63
+ };
64
+ }
65
+ var _ast$ObjectEntry$getP = ast.ObjectEntry.getProperty(node),
66
+ property = _ast$ObjectEntry$getP.value;
67
+
68
+ // Bail if the property is not `padding`, `margin`, etc
69
+ if (!property || !styleMap.includes(property)) {
70
+ return {
71
+ success: false,
72
+ ref: undefined
73
+ };
74
+ }
75
+ var value = ast.ObjectEntry.getValue(node);
76
+ if (typeof value !== 'string') {
77
+ return {
78
+ success: false,
79
+ ref: undefined
80
+ };
81
+ }
82
+
83
+ // There are valid values to ignore, such as tokens, or `margin: auto`
84
+ if (supported.values.ignore.includes(value)) {
85
+ return {
86
+ success: false,
87
+ ref: undefined
88
+ };
89
+ }
90
+ return {
91
+ success: true,
92
+ ref: node
93
+ };
94
+ }
95
+ };
@@ -0,0 +1 @@
1
+ export var styleMap = ['margin-block-end', 'margin-block-start', 'margin-block', 'margin-bottom', 'margin-inline-end', 'margin-inline-start', 'margin-inline', 'margin-left', 'margin-right', 'margin-top', 'padding-block-end', 'padding-block-start', 'padding-block', 'padding-bottom', 'padding-inline-end', 'padding-inline-start', 'padding-inline', 'padding-left', 'padding-right', 'padding-top', 'margin', 'marginBlock', 'marginBlockEnd', 'marginBlockStart', 'marginBottom', 'marginInline', 'marginInlineEnd', 'marginInlineStart', 'marginLeft', 'marginRight', 'marginTop', 'padding', 'paddingBlock', 'paddingBlockEnd', 'paddingBlockStart', 'paddingBottom', 'paddingInline', 'paddingInlineEnd', 'paddingInlineStart', 'paddingLeft', 'paddingRight', 'paddingTop'];
@@ -0,0 +1,7 @@
1
+ export default {
2
+ values: {
3
+ ignore: ['auto', 'initial', 'inherit', 'unset', 'revert', 'revert-layer',
4
+ // Currently the DST opinion is that 0 is valid. It doesn't need to be converted to `space.0`
5
+ '0', 'space.negative.025', 'space.negative.050', 'space.negative.075', 'space.negative.100', 'space.negative.150', 'space.negative.200', 'space.negative.250', 'space.negative.300', 'space.negative.400', 'space.025', 'space.050', 'space.075', 'space.100', 'space.150', 'space.200', 'space.250', 'space.300', 'space.400', 'space.500', 'space.600', 'space.800', 'space.1000']
6
+ }
7
+ };
@@ -0,0 +1 @@
1
+ export { isStringOrNumber } from './is-string-or-number';
@@ -0,0 +1,3 @@
1
+ export var isStringOrNumber = function isStringOrNumber(value) {
2
+ return typeof value === 'string' || typeof value === 'number';
3
+ };
@@ -89,6 +89,12 @@ export var StyleObject = {
89
89
  var fontFamilyNode = ASTObject.getEntryByPropertyName(node, 'fontFamily');
90
90
  var fontFamilyRaw = fontFamilyNode && getValueForPropertyNode(fontFamilyNode, context);
91
91
  var fontFamilyValue = fontFamilyRaw && normaliseValue('fontFamily', fontFamilyRaw) || undefined;
92
+
93
+ // If font family is already a token, we remove and re-add it
94
+ // Only need to do this for non-default font stacks as the defaults can be safely removed
95
+ if (fontFamilyValue && fontFamilyValue.includes('font.family.') && !(fontFamilyValue.includes('font.family.heading') || fontFamilyValue.includes('font.family.body'))) {
96
+ fontFamilyValue = undefined;
97
+ }
92
98
  var fontFamilyToAdd;
93
99
  // If font family uses the Charlie font we can't replace; exit
94
100
  if (fontFamilyValue) {
@@ -33,6 +33,7 @@ export declare const configs: {
33
33
  '@atlaskit/design-system/use-heading': string;
34
34
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
35
35
  '@atlaskit/design-system/use-href-in-link-item': string;
36
+ '@atlaskit/design-system/use-latest-xcss-syntax': string;
36
37
  '@atlaskit/design-system/use-popup-label': string;
37
38
  '@atlaskit/design-system/use-primitives': string;
38
39
  '@atlaskit/design-system/use-primitives-text': string;
@@ -64,6 +65,7 @@ export declare const configs: {
64
65
  '@atlaskit/design-system/use-drawer-label': string;
65
66
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
66
67
  '@atlaskit/design-system/use-href-in-link-item': string;
68
+ '@atlaskit/design-system/use-latest-xcss-syntax': string;
67
69
  '@atlaskit/design-system/use-popup-label': string;
68
70
  '@atlaskit/design-system/use-visually-hidden': string;
69
71
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::0be7639a95bf4c9bbfe00154d8193477>>
3
+ * @codegen <<SignedSource::8453f9be2d12c65323a70743b71f7474>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  declare const _default: {
@@ -36,6 +36,7 @@ declare const _default: {
36
36
  '@atlaskit/design-system/use-heading': string;
37
37
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
38
38
  '@atlaskit/design-system/use-href-in-link-item': string;
39
+ '@atlaskit/design-system/use-latest-xcss-syntax': string;
39
40
  '@atlaskit/design-system/use-popup-label': string;
40
41
  '@atlaskit/design-system/use-primitives': string;
41
42
  '@atlaskit/design-system/use-primitives-text': string;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::73a3666b244b58cc221eebcda071161d>>
3
+ * @codegen <<SignedSource::c67c53656bcdaedb72953c8026a01c24>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  declare const _default: {
@@ -26,6 +26,7 @@ declare const _default: {
26
26
  '@atlaskit/design-system/use-drawer-label': string;
27
27
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
28
28
  '@atlaskit/design-system/use-href-in-link-item': string;
29
+ '@atlaskit/design-system/use-latest-xcss-syntax': string;
29
30
  '@atlaskit/design-system/use-popup-label': string;
30
31
  '@atlaskit/design-system/use-visually-hidden': string;
31
32
  };
@@ -33,6 +33,7 @@ declare const _default: {
33
33
  'use-heading': import("eslint").Rule.RuleModule;
34
34
  'use-heading-level-in-spotlight-card': import("eslint").Rule.RuleModule;
35
35
  'use-href-in-link-item': import("eslint").Rule.RuleModule;
36
+ 'use-latest-xcss-syntax': import("eslint").Rule.RuleModule;
36
37
  'use-popup-label': import("eslint").Rule.RuleModule;
37
38
  'use-primitives': import("eslint").Rule.RuleModule;
38
39
  'use-primitives-text': import("eslint").Rule.RuleModule;
@@ -0,0 +1,4 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const noRawSpacingValues = "Don't use non-token values in padding or margin. There is ongoing work to make this a TypeScript error. Once that happens, you will have to delete/refactor anyway. Atlassians: See https://go.atlassian.com/xcss-spacing for details.";
3
+ declare const rule: Rule.RuleModule;
4
+ export default rule;
@@ -0,0 +1 @@
1
+ export { StyleProperty } from './style-property';
@@ -0,0 +1,18 @@
1
+ import type { Rule } from 'eslint';
2
+ import { type Property as ObjectEntry } from 'eslint-codemod-utils';
3
+ type Check = {
4
+ success: false;
5
+ ref: undefined;
6
+ } | {
7
+ success: true;
8
+ ref: ObjectEntry;
9
+ };
10
+ export declare const StyleProperty: {
11
+ lint(node: Rule.Node, { context }: {
12
+ context: Rule.RuleContext;
13
+ }): void;
14
+ _check(node: Rule.Node, { context }: {
15
+ context: Rule.RuleContext;
16
+ }): Check;
17
+ };
18
+ export {};
@@ -0,0 +1 @@
1
+ export declare const styleMap: string[];
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ values: {
3
+ ignore: string[];
4
+ };
5
+ };
6
+ export default _default;
@@ -0,0 +1 @@
1
+ export { isStringOrNumber } from './is-string-or-number';
@@ -0,0 +1 @@
1
+ export declare const isStringOrNumber: (value: string | number | bigint | true | RegExp | undefined) => value is string | number;
@@ -33,6 +33,7 @@ export declare const configs: {
33
33
  '@atlaskit/design-system/use-heading': string;
34
34
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
35
35
  '@atlaskit/design-system/use-href-in-link-item': string;
36
+ '@atlaskit/design-system/use-latest-xcss-syntax': string;
36
37
  '@atlaskit/design-system/use-popup-label': string;
37
38
  '@atlaskit/design-system/use-primitives': string;
38
39
  '@atlaskit/design-system/use-primitives-text': string;
@@ -64,6 +65,7 @@ export declare const configs: {
64
65
  '@atlaskit/design-system/use-drawer-label': string;
65
66
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
66
67
  '@atlaskit/design-system/use-href-in-link-item': string;
68
+ '@atlaskit/design-system/use-latest-xcss-syntax': string;
67
69
  '@atlaskit/design-system/use-popup-label': string;
68
70
  '@atlaskit/design-system/use-visually-hidden': string;
69
71
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::0be7639a95bf4c9bbfe00154d8193477>>
3
+ * @codegen <<SignedSource::8453f9be2d12c65323a70743b71f7474>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  declare const _default: {
@@ -36,6 +36,7 @@ declare const _default: {
36
36
  '@atlaskit/design-system/use-heading': string;
37
37
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
38
38
  '@atlaskit/design-system/use-href-in-link-item': string;
39
+ '@atlaskit/design-system/use-latest-xcss-syntax': string;
39
40
  '@atlaskit/design-system/use-popup-label': string;
40
41
  '@atlaskit/design-system/use-primitives': string;
41
42
  '@atlaskit/design-system/use-primitives-text': string;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::73a3666b244b58cc221eebcda071161d>>
3
+ * @codegen <<SignedSource::c67c53656bcdaedb72953c8026a01c24>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  declare const _default: {
@@ -26,6 +26,7 @@ declare const _default: {
26
26
  '@atlaskit/design-system/use-drawer-label': string;
27
27
  '@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
28
28
  '@atlaskit/design-system/use-href-in-link-item': string;
29
+ '@atlaskit/design-system/use-latest-xcss-syntax': string;
29
30
  '@atlaskit/design-system/use-popup-label': string;
30
31
  '@atlaskit/design-system/use-visually-hidden': string;
31
32
  };
@@ -37,6 +37,7 @@ declare const _default: {
37
37
  'use-heading': import("eslint").Rule.RuleModule;
38
38
  'use-heading-level-in-spotlight-card': import("eslint").Rule.RuleModule;
39
39
  'use-href-in-link-item': import("eslint").Rule.RuleModule;
40
+ 'use-latest-xcss-syntax': import("eslint").Rule.RuleModule;
40
41
  'use-popup-label': import("eslint").Rule.RuleModule;
41
42
  'use-primitives': import("eslint").Rule.RuleModule;
42
43
  'use-primitives-text': import("eslint").Rule.RuleModule;
@@ -0,0 +1,4 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const noRawSpacingValues = "Don't use non-token values in padding or margin. There is ongoing work to make this a TypeScript error. Once that happens, you will have to delete/refactor anyway. Atlassians: See https://go.atlassian.com/xcss-spacing for details.";
3
+ declare const rule: Rule.RuleModule;
4
+ export default rule;
@@ -0,0 +1 @@
1
+ export { StyleProperty } from './style-property';
@@ -0,0 +1,18 @@
1
+ import type { Rule } from 'eslint';
2
+ import { type Property as ObjectEntry } from 'eslint-codemod-utils';
3
+ type Check = {
4
+ success: false;
5
+ ref: undefined;
6
+ } | {
7
+ success: true;
8
+ ref: ObjectEntry;
9
+ };
10
+ export declare const StyleProperty: {
11
+ lint(node: Rule.Node, { context }: {
12
+ context: Rule.RuleContext;
13
+ }): void;
14
+ _check(node: Rule.Node, { context }: {
15
+ context: Rule.RuleContext;
16
+ }): Check;
17
+ };
18
+ export {};
@@ -0,0 +1 @@
1
+ export declare const styleMap: string[];
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ values: {
3
+ ignore: string[];
4
+ };
5
+ };
6
+ export default _default;
@@ -0,0 +1 @@
1
+ export { isStringOrNumber } from './is-string-or-number';
@@ -0,0 +1 @@
1
+ export declare const isStringOrNumber: (value: string | number | bigint | true | RegExp | undefined) => value is string | number;
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": "10.3.1",
4
+ "version": "10.4.1",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {