@atlaskit/eslint-plugin-design-system 10.3.0 → 10.4.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 +17 -0
- package/README.md +1 -0
- package/constellation/index/usage.mdx +1 -0
- package/constellation/use-latest-xcss-syntax/usage.mdx +33 -0
- package/dist/cjs/presets/all.codegen.js +2 -1
- package/dist/cjs/presets/recommended.codegen.js +2 -1
- package/dist/cjs/rules/index.codegen.js +3 -1
- package/dist/cjs/rules/use-latest-xcss-syntax/index.js +35 -0
- package/dist/cjs/rules/use-latest-xcss-syntax/transformers/index.js +12 -0
- package/dist/cjs/rules/use-latest-xcss-syntax/transformers/style-property/index.js +105 -0
- package/dist/cjs/rules/use-latest-xcss-syntax/transformers/style-property/style-map.js +7 -0
- package/dist/cjs/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +13 -0
- package/dist/cjs/rules/use-latest-xcss-syntax/utils/index.js +12 -0
- package/dist/cjs/rules/use-latest-xcss-syntax/utils/is-string-or-number.js +9 -0
- package/dist/cjs/rules/use-tokens-typography/transformers/style-object.js +11 -0
- package/dist/es2019/presets/all.codegen.js +2 -1
- package/dist/es2019/presets/recommended.codegen.js +2 -1
- package/dist/es2019/rules/index.codegen.js +3 -1
- package/dist/es2019/rules/use-latest-xcss-syntax/index.js +27 -0
- package/dist/es2019/rules/use-latest-xcss-syntax/transformers/index.js +1 -0
- package/dist/es2019/rules/use-latest-xcss-syntax/transformers/style-property/index.js +99 -0
- package/dist/es2019/rules/use-latest-xcss-syntax/transformers/style-property/style-map.js +1 -0
- package/dist/es2019/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +7 -0
- package/dist/es2019/rules/use-latest-xcss-syntax/utils/index.js +1 -0
- package/dist/es2019/rules/use-latest-xcss-syntax/utils/is-string-or-number.js +3 -0
- package/dist/es2019/rules/use-tokens-typography/transformers/style-object.js +12 -1
- package/dist/esm/presets/all.codegen.js +2 -1
- package/dist/esm/presets/recommended.codegen.js +2 -1
- package/dist/esm/rules/index.codegen.js +3 -1
- package/dist/esm/rules/use-latest-xcss-syntax/index.js +29 -0
- package/dist/esm/rules/use-latest-xcss-syntax/transformers/index.js +1 -0
- package/dist/esm/rules/use-latest-xcss-syntax/transformers/style-property/index.js +95 -0
- package/dist/esm/rules/use-latest-xcss-syntax/transformers/style-property/style-map.js +1 -0
- package/dist/esm/rules/use-latest-xcss-syntax/transformers/style-property/supported.js +7 -0
- package/dist/esm/rules/use-latest-xcss-syntax/utils/index.js +1 -0
- package/dist/esm/rules/use-latest-xcss-syntax/utils/is-string-or-number.js +3 -0
- package/dist/esm/rules/use-tokens-typography/transformers/style-object.js +11 -0
- package/dist/types/ast-nodes/function-call.d.ts +1 -1
- package/dist/types/ast-nodes/jsx-attribute.d.ts +1 -1
- package/dist/types/ast-nodes/jsx-element.d.ts +1 -1
- package/dist/types/ast-nodes/object-entry.d.ts +1 -1
- package/dist/types/ast-nodes/object.d.ts +1 -1
- package/dist/types/ast-nodes/root.d.ts +1 -1
- package/dist/types/index.codegen.d.ts +2 -0
- package/dist/types/presets/all.codegen.d.ts +2 -1
- package/dist/types/presets/recommended.codegen.d.ts +2 -1
- package/dist/types/rules/ensure-design-token-usage/color.d.ts +1 -1
- package/dist/types/rules/ensure-design-token-usage/error-boundary.d.ts +1 -1
- package/dist/types/rules/ensure-design-token-usage/shape.d.ts +1 -1
- package/dist/types/rules/ensure-design-token-usage/spacing.d.ts +1 -1
- package/dist/types/rules/ensure-design-token-usage/utils.d.ts +2 -2
- package/dist/types/rules/index.codegen.d.ts +1 -0
- package/dist/types/rules/no-deprecated-apis/index.d.ts +2 -2
- package/dist/types/rules/no-deprecated-imports/index.d.ts +2 -2
- package/dist/types/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-add-event-listener.d.ts +1 -1
- package/dist/types/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.d.ts +1 -1
- package/dist/types/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.d.ts +1 -1
- package/dist/types/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-jsx-attribute.d.ts +1 -1
- package/dist/types/rules/no-direct-use-of-web-platform-drag-and-drop/shared/is-blocked-event-binding.d.ts +1 -1
- package/dist/types/rules/use-heading/transformers/common.d.ts +2 -2
- package/dist/types/rules/use-href-in-link-item/utils.d.ts +1 -1
- package/dist/types/rules/use-latest-xcss-syntax/index.d.ts +4 -0
- package/dist/types/rules/use-latest-xcss-syntax/transformers/index.d.ts +1 -0
- package/dist/types/rules/use-latest-xcss-syntax/transformers/style-property/index.d.ts +18 -0
- package/dist/types/rules/use-latest-xcss-syntax/transformers/style-property/style-map.d.ts +1 -0
- package/dist/types/rules/use-latest-xcss-syntax/transformers/style-property/supported.d.ts +6 -0
- package/dist/types/rules/use-latest-xcss-syntax/utils/index.d.ts +1 -0
- package/dist/types/rules/use-latest-xcss-syntax/utils/is-string-or-number.d.ts +1 -0
- package/dist/types/rules/use-primitives/transformers/compiled-styled/convert-jsx-call-site.d.ts +1 -1
- package/dist/types/rules/use-primitives/transformers/compiled-styled/convert-styled-component-call-to-jsx.d.ts +1 -1
- package/dist/types/rules/use-primitives/transformers/compiled-styled/find-valid-jsx-usage-to-transform.d.ts +1 -1
- package/dist/types/rules/use-primitives/transformers/compiled-styled/index.d.ts +2 -2
- package/dist/types/rules/use-primitives/transformers/emotion-css/index.d.ts +2 -2
- package/dist/types/rules/use-primitives/utils/convert-ast-object-expression-to-js-object.d.ts +1 -1
- package/dist/types/rules/use-primitives/utils/get-attribute-value-identifier.d.ts +1 -1
- package/dist/types/rules/use-primitives/utils/get-jsx-attribute-by-name.d.ts +1 -1
- package/dist/types/rules/use-primitives/utils/is-valid-css-properties-to-transform.d.ts +2 -2
- package/dist/types/rules/use-primitives/utils/update-jsx-attribute-by-name.d.ts +1 -1
- package/dist/types/rules/use-primitives/utils/validate-styles.d.ts +2 -2
- package/dist/types/rules/use-primitives-text/transformers/common.d.ts +2 -2
- package/dist/types/rules/use-tokens-space/transformers/style-property/index.d.ts +1 -1
- package/dist/types/rules/use-tokens-typography/config/index.d.ts +1 -1
- package/dist/types/rules/use-tokens-typography/error-boundary.d.ts +1 -1
- package/dist/types/rules/use-tokens-typography/transformers/style-object.d.ts +3 -3
- package/dist/types/rules/use-tokens-typography/utils.d.ts +1 -1
- package/dist/types/rules/use-visually-hidden/utils.d.ts +1 -1
- package/dist/types/rules/utils/create-no-exported-rule/check-if-supported-export.d.ts +1 -1
- package/dist/types/rules/utils/create-no-tagged-template-expression-rule/index.d.ts +1 -1
- package/dist/types/rules/utils/get-first-supported-import.d.ts +2 -2
- package/dist/types/rules/utils/is-elevation.d.ts +1 -1
- package/dist/types-ts4.5/ast-nodes/function-call.d.ts +1 -1
- package/dist/types-ts4.5/ast-nodes/jsx-attribute.d.ts +1 -1
- package/dist/types-ts4.5/ast-nodes/jsx-element.d.ts +1 -1
- package/dist/types-ts4.5/ast-nodes/object-entry.d.ts +1 -1
- package/dist/types-ts4.5/ast-nodes/object.d.ts +1 -1
- package/dist/types-ts4.5/ast-nodes/root.d.ts +1 -1
- package/dist/types-ts4.5/index.codegen.d.ts +2 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +2 -1
- package/dist/types-ts4.5/rules/ensure-design-token-usage/color.d.ts +1 -1
- package/dist/types-ts4.5/rules/ensure-design-token-usage/error-boundary.d.ts +1 -1
- package/dist/types-ts4.5/rules/ensure-design-token-usage/shape.d.ts +1 -1
- package/dist/types-ts4.5/rules/ensure-design-token-usage/spacing.d.ts +1 -1
- package/dist/types-ts4.5/rules/ensure-design-token-usage/utils.d.ts +2 -2
- package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/rules/no-deprecated-apis/index.d.ts +2 -2
- package/dist/types-ts4.5/rules/no-deprecated-imports/index.d.ts +2 -2
- package/dist/types-ts4.5/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-add-event-listener.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-jsx-attribute.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-direct-use-of-web-platform-drag-and-drop/shared/is-blocked-event-binding.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-heading/transformers/common.d.ts +2 -2
- package/dist/types-ts4.5/rules/use-href-in-link-item/utils.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-latest-xcss-syntax/index.d.ts +4 -0
- package/dist/types-ts4.5/rules/use-latest-xcss-syntax/transformers/index.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-latest-xcss-syntax/transformers/style-property/index.d.ts +18 -0
- package/dist/types-ts4.5/rules/use-latest-xcss-syntax/transformers/style-property/style-map.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-latest-xcss-syntax/transformers/style-property/supported.d.ts +6 -0
- package/dist/types-ts4.5/rules/use-latest-xcss-syntax/utils/index.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-latest-xcss-syntax/utils/is-string-or-number.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-primitives/transformers/compiled-styled/convert-jsx-call-site.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-primitives/transformers/compiled-styled/convert-styled-component-call-to-jsx.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-primitives/transformers/compiled-styled/find-valid-jsx-usage-to-transform.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-primitives/transformers/compiled-styled/index.d.ts +2 -2
- package/dist/types-ts4.5/rules/use-primitives/transformers/emotion-css/index.d.ts +2 -2
- package/dist/types-ts4.5/rules/use-primitives/utils/convert-ast-object-expression-to-js-object.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-primitives/utils/get-attribute-value-identifier.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-primitives/utils/get-jsx-attribute-by-name.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-primitives/utils/is-valid-css-properties-to-transform.d.ts +2 -2
- package/dist/types-ts4.5/rules/use-primitives/utils/update-jsx-attribute-by-name.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-primitives/utils/validate-styles.d.ts +2 -2
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/common.d.ts +2 -2
- package/dist/types-ts4.5/rules/use-tokens-space/transformers/style-property/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-tokens-typography/config/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-tokens-typography/error-boundary.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-tokens-typography/transformers/style-object.d.ts +3 -3
- package/dist/types-ts4.5/rules/use-tokens-typography/utils.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-visually-hidden/utils.d.ts +1 -1
- package/dist/types-ts4.5/rules/utils/create-no-exported-rule/check-if-supported-export.d.ts +1 -1
- package/dist/types-ts4.5/rules/utils/create-no-tagged-template-expression-rule/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/utils/get-first-supported-import.d.ts +2 -2
- package/dist/types-ts4.5/rules/utils/is-elevation.d.ts +1 -1
- 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.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#103102](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103102)
|
|
8
|
+
[`3c920b0719af`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3c920b0719af) -
|
|
9
|
+
Add `use-latest-xcss-syntax` eslint rule.
|
|
10
|
+
|
|
11
|
+
## 10.3.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#102908](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102908)
|
|
16
|
+
[`b08bb74e2894`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b08bb74e2894) -
|
|
17
|
+
Fixed an issue with the `use-tokens-typography` rule where font weights that were already using
|
|
18
|
+
a token could break the token matching logic and cause the font weight property to be removed.
|
|
19
|
+
|
|
3
20
|
## 10.3.0
|
|
4
21
|
|
|
5
22
|
### Minor 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::
|
|
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::
|
|
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::
|
|
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
|
+
};
|
|
@@ -44,6 +44,17 @@ var StyleObject = exports.StyleObject = {
|
|
|
44
44
|
var fontWeightNode = _astNodes.Object.getEntryByPropertyName(node, 'fontWeight');
|
|
45
45
|
var fontWeightRaw = fontWeightNode && (0, _utils.getValueForPropertyNode)(fontWeightNode, context);
|
|
46
46
|
|
|
47
|
+
// If fontWeightRaw is a token we find the token name and treat it like a raw value for simplicity.
|
|
48
|
+
// e.g. token('font.weight.bold', '700') ends up as '700' after this if-block.
|
|
49
|
+
// That way the token matching logic still runs and the font weight declaration can be removed and re-added after the main font token.
|
|
50
|
+
if (fontWeightRaw && typeof fontWeightRaw === 'string' && fontWeightRaw.includes('font.weight.')) {
|
|
51
|
+
var _fontWeightRaw$match;
|
|
52
|
+
var fontWeightTokenSuffix = ((_fontWeightRaw$match = fontWeightRaw.match(/font\.weight\.(\w*)/)) === null || _fontWeightRaw$match === void 0 ? void 0 : _fontWeightRaw$match[1]) || 'regular'; // ${token('font.weight.bold', '700')} -> 'bold'
|
|
53
|
+
if (Object.keys(_utils2.fontWeightMap).includes(fontWeightTokenSuffix)) {
|
|
54
|
+
fontWeightRaw = _utils2.fontWeightMap[fontWeightTokenSuffix];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
47
58
|
// If no fontWeight value exists, default to 400 to avoid matching with a bolder token resulting in a visual change
|
|
48
59
|
var fontWeightValue = fontWeightRaw && (0, _utils.normaliseValue)('fontWeight', fontWeightRaw) || _utils2.defaultFontWeight;
|
|
49
60
|
fontWeightValue = fontWeightValue.length === 3 ? fontWeightValue : _utils2.fontWeightMap[fontWeightValue] || _utils2.defaultFontWeight;
|
|
@@ -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::
|
|
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::
|
|
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::
|
|
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';
|
|
@@ -40,7 +40,18 @@ export const StyleObject = {
|
|
|
40
40
|
|
|
41
41
|
// -- Font weight --
|
|
42
42
|
const fontWeightNode = ASTObject.getEntryByPropertyName(node, 'fontWeight');
|
|
43
|
-
|
|
43
|
+
let fontWeightRaw = fontWeightNode && getValueForPropertyNode(fontWeightNode, context);
|
|
44
|
+
|
|
45
|
+
// If fontWeightRaw is a token we find the token name and treat it like a raw value for simplicity.
|
|
46
|
+
// e.g. token('font.weight.bold', '700') ends up as '700' after this if-block.
|
|
47
|
+
// That way the token matching logic still runs and the font weight declaration can be removed and re-added after the main font token.
|
|
48
|
+
if (fontWeightRaw && typeof fontWeightRaw === 'string' && fontWeightRaw.includes('font.weight.')) {
|
|
49
|
+
var _fontWeightRaw$match;
|
|
50
|
+
const fontWeightTokenSuffix = ((_fontWeightRaw$match = fontWeightRaw.match(/font\.weight\.(\w*)/)) === null || _fontWeightRaw$match === void 0 ? void 0 : _fontWeightRaw$match[1]) || 'regular'; // ${token('font.weight.bold', '700')} -> 'bold'
|
|
51
|
+
if (Object.keys(fontWeightMap).includes(fontWeightTokenSuffix)) {
|
|
52
|
+
fontWeightRaw = fontWeightMap[fontWeightTokenSuffix];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
44
55
|
|
|
45
56
|
// If no fontWeight value exists, default to 400 to avoid matching with a bolder token resulting in a visual change
|
|
46
57
|
let fontWeightValue = fontWeightRaw && normaliseValue('fontWeight', fontWeightRaw) || defaultFontWeight;
|
|
@@ -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::
|
|
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::
|
|
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
|
}
|