@atlaskit/eslint-plugin-design-system 10.8.0 → 10.8.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.
- package/CHANGELOG.md +10 -0
- package/README.md +1 -0
- package/constellation/index/usage.mdx +1 -0
- package/constellation/use-latest-xcss-syntax-typography/usage.mdx +34 -0
- package/dist/cjs/ast-nodes/object-entry.js +2 -1
- 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-typography/index.js +40 -0
- package/dist/cjs/rules/use-latest-xcss-syntax-typography/linters/banned-property/index.js +18 -0
- package/dist/cjs/rules/use-latest-xcss-syntax-typography/linters/index.js +12 -0
- package/dist/es2019/ast-nodes/object-entry.js +2 -1
- 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-typography/index.js +30 -0
- package/dist/es2019/rules/use-latest-xcss-syntax-typography/linters/banned-property/index.js +13 -0
- package/dist/es2019/rules/use-latest-xcss-syntax-typography/linters/index.js +1 -0
- package/dist/esm/ast-nodes/object-entry.js +2 -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-typography/index.js +34 -0
- package/dist/esm/rules/use-latest-xcss-syntax-typography/linters/banned-property/index.js +12 -0
- package/dist/esm/rules/use-latest-xcss-syntax-typography/linters/index.js +1 -0
- 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/index.codegen.d.ts +1 -0
- package/dist/types/rules/use-latest-xcss-syntax-typography/index.d.ts +4 -0
- package/dist/types/rules/use-latest-xcss-syntax-typography/linters/banned-property/index.d.ts +6 -0
- package/dist/types/rules/use-latest-xcss-syntax-typography/linters/index.d.ts +1 -0
- 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/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/index.d.ts +4 -0
- package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/linters/banned-property/index.d.ts +6 -0
- package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/linters/index.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 10.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#113465](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/113465)
|
|
8
|
+
[`1b198cf33c32e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1b198cf33c32e) -
|
|
9
|
+
Create `use-latest-xcss-syntax-typography` rule. Bans the use of 'fontSize', 'lineHeight',
|
|
10
|
+
'fontWeight' on xcss.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 10.8.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -81,6 +81,7 @@ module.exports = {
|
|
|
81
81
|
| <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 | |
|
|
82
82
|
| <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 |
|
|
83
83
|
| <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 | |
|
|
84
|
+
| <a href="./src/rules/use-latest-xcss-syntax-typography/README.md">use-latest-xcss-syntax-typography</a> | Prohibits use of unsafe styling properties in xcss. Please use Text/Heading primitives instead. | Yes | Yes | |
|
|
84
85
|
| <a href="./src/rules/use-menu-section-title/README.md">use-menu-section-title</a> | Encourages makers to provide accessible title for Atlassian Design System Menu Section component. | Yes | | Yes |
|
|
85
86
|
| <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 |
|
|
86
87
|
| <a href="./src/rules/use-primitives/README.md">use-primitives</a> | Encourage the usage of primitives components. | | Yes | Yes |
|
|
@@ -44,6 +44,7 @@ This plugin contains rules that should be used when working with the
|
|
|
44
44
|
| <a href="/components/eslint-plugin-design-system/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 | |
|
|
45
45
|
| <a href="/components/eslint-plugin-design-system/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 |
|
|
46
46
|
| <a href="/components/eslint-plugin-design-system/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 | |
|
|
47
|
+
| <a href="/components/eslint-plugin-design-system/use-latest-xcss-syntax-typography/usage">use-latest-xcss-syntax-typography</a> | Prohibits use of unsafe styling properties in xcss. Please use Text/Heading primitives instead. | Yes | Yes | |
|
|
47
48
|
| <a href="/components/eslint-plugin-design-system/use-menu-section-title/usage">use-menu-section-title</a> | Encourages makers to provide accessible title for Atlassian Design System Menu Section component. | Yes | | Yes |
|
|
48
49
|
| <a href="/components/eslint-plugin-design-system/use-popup-label/usage">use-popup-label</a> | Encourages to provide accessible name for Atlassian Design System Popup component. | Yes | | Yes |
|
|
49
50
|
| <a href="/components/eslint-plugin-design-system/use-primitives/usage">use-primitives</a> | Encourage the usage of primitives components. | | Yes | Yes |
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# use-latest-xcss-syntax-typography
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Soon, applying `fontSize`, `lineHeight`, `fontWeight` with `xcss` will be deprecated. Please refrain
|
|
6
|
+
from adding new usages, as you will need to remove them soon anyway. As an alternative, you can use
|
|
7
|
+
the `Text` and `Heading` primitives.
|
|
8
|
+
|
|
9
|
+
## Examples
|
|
10
|
+
|
|
11
|
+
### Incorrect
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
const myStyles = xcss({
|
|
15
|
+
fontSize: '14px',
|
|
16
|
+
^^^^^^^^^^^^^^^^
|
|
17
|
+
lineHeight: '20px',
|
|
18
|
+
^^^^^^^^^^^^^^^^^^
|
|
19
|
+
fontWeight: 500,
|
|
20
|
+
^^^^^^^^^^^^^^^
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
<Box as="p" xcss={myStyles}>
|
|
24
|
+
...
|
|
25
|
+
</Box>;
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Correct
|
|
29
|
+
|
|
30
|
+
```jsx
|
|
31
|
+
import { Text } from '@atlaskit/primitives';
|
|
32
|
+
|
|
33
|
+
<Text weight="medium">...</Text>;
|
|
34
|
+
```
|
|
@@ -66,7 +66,8 @@ var ObjectEntry = exports.ObjectEntry = {
|
|
|
66
66
|
return undefined;
|
|
67
67
|
}
|
|
68
68
|
if ((0, _eslintCodemodUtils.isNodeOfType)(node.key, 'Literal')) {
|
|
69
|
-
|
|
69
|
+
var _node$key$value;
|
|
70
|
+
return (_node$key$value = node.key.value) === null || _node$key$value === void 0 ? void 0 : _node$key$value.toString();
|
|
70
71
|
}
|
|
71
72
|
if ((0, _eslintCodemodUtils.isNodeOfType)(node.key, 'Identifier')) {
|
|
72
73
|
return node.key.name;
|
|
@@ -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::9bb5329713677543f16019954484ae2f>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -44,6 +44,7 @@ var _default = exports.default = {
|
|
|
44
44
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
45
45
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
46
46
|
'@atlaskit/design-system/use-latest-xcss-syntax': 'error',
|
|
47
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': 'warn',
|
|
47
48
|
'@atlaskit/design-system/use-menu-section-title': 'warn',
|
|
48
49
|
'@atlaskit/design-system/use-popup-label': 'warn',
|
|
49
50
|
'@atlaskit/design-system/use-primitives': '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::76bee1648b1b78d3ad253f0704a9cac7>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -34,6 +34,7 @@ var _default = exports.default = {
|
|
|
34
34
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
35
35
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
36
36
|
'@atlaskit/design-system/use-latest-xcss-syntax': 'error',
|
|
37
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': 'warn',
|
|
37
38
|
'@atlaskit/design-system/use-menu-section-title': 'warn',
|
|
38
39
|
'@atlaskit/design-system/use-popup-label': 'warn',
|
|
39
40
|
'@atlaskit/design-system/use-visually-hidden': 'error'
|
|
@@ -37,6 +37,7 @@ var _useHeading = _interopRequireDefault(require("./use-heading"));
|
|
|
37
37
|
var _useHeadingLevelInSpotlightCard = _interopRequireDefault(require("./use-heading-level-in-spotlight-card"));
|
|
38
38
|
var _useHrefInLinkItem = _interopRequireDefault(require("./use-href-in-link-item"));
|
|
39
39
|
var _useLatestXcssSyntax = _interopRequireDefault(require("./use-latest-xcss-syntax"));
|
|
40
|
+
var _useLatestXcssSyntaxTypography = _interopRequireDefault(require("./use-latest-xcss-syntax-typography"));
|
|
40
41
|
var _useMenuSectionTitle = _interopRequireDefault(require("./use-menu-section-title"));
|
|
41
42
|
var _usePopupLabel = _interopRequireDefault(require("./use-popup-label"));
|
|
42
43
|
var _usePrimitives = _interopRequireDefault(require("./use-primitives"));
|
|
@@ -46,7 +47,7 @@ var _useTokensTypography = _interopRequireDefault(require("./use-tokens-typograp
|
|
|
46
47
|
var _useVisuallyHidden = _interopRequireDefault(require("./use-visually-hidden"));
|
|
47
48
|
/**
|
|
48
49
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
49
|
-
* @codegen <<SignedSource::
|
|
50
|
+
* @codegen <<SignedSource::b359d356c482db0087ddfce5bd105403>>
|
|
50
51
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
51
52
|
*/
|
|
52
53
|
var _default = exports.default = {
|
|
@@ -82,6 +83,7 @@ var _default = exports.default = {
|
|
|
82
83
|
'use-heading-level-in-spotlight-card': _useHeadingLevelInSpotlightCard.default,
|
|
83
84
|
'use-href-in-link-item': _useHrefInLinkItem.default,
|
|
84
85
|
'use-latest-xcss-syntax': _useLatestXcssSyntax.default,
|
|
86
|
+
'use-latest-xcss-syntax-typography': _useLatestXcssSyntaxTypography.default,
|
|
85
87
|
'use-menu-section-title': _useMenuSectionTitle.default,
|
|
86
88
|
'use-popup-label': _usePopupLabel.default,
|
|
87
89
|
'use-primitives': _usePrimitives.default,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.error = exports.default = void 0;
|
|
7
|
+
var _createRule = require("../utils/create-rule");
|
|
8
|
+
var _linters = require("./linters");
|
|
9
|
+
var error = exports.error = "Don't set fontSize, lineHeight, fontWeight properties on xcss. They are unsafe as they allow invalid combinations of typography tokens. There is ongoing work to make this a TypeScript error. Once that happens, you will have to delete/refactor anyway.";
|
|
10
|
+
var rule = (0, _createRule.createLintRule)({
|
|
11
|
+
meta: {
|
|
12
|
+
name: 'use-latest-xcss-syntax-typography',
|
|
13
|
+
type: 'problem',
|
|
14
|
+
fixable: 'code',
|
|
15
|
+
hasSuggestions: false,
|
|
16
|
+
docs: {
|
|
17
|
+
description: 'Prohibits use of unsafe styling properties in xcss. Please use Text/Heading primitives instead.',
|
|
18
|
+
recommended: true,
|
|
19
|
+
severity: 'warn'
|
|
20
|
+
},
|
|
21
|
+
messages: {
|
|
22
|
+
noUnsafeTypographyProperties: error
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
create: function create(context) {
|
|
26
|
+
return {
|
|
27
|
+
'CallExpression[callee.name="xcss"] ObjectExpression > Property > Identifier[name=/(fontSize|lineHeight|fontWeight)/]': function CallExpressionCalleeNameXcssObjectExpressionPropertyIdentifierNameFontSizeLineHeightFontWeight(node) {
|
|
28
|
+
return _linters.BannedProperty.lint(node, {
|
|
29
|
+
context: context
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
'CallExpression[callee.name="xcss"] ObjectExpression > Property > Literal[value=/(fontSize|lineHeight|fontWeight)/]': function CallExpressionCalleeNameXcssObjectExpressionPropertyLiteralValueFontSizeLineHeightFontWeight(node) {
|
|
33
|
+
return _linters.BannedProperty.lint(node, {
|
|
34
|
+
context: context
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
var _default = exports.default = rule;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BannedProperty = void 0;
|
|
7
|
+
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
8
|
+
|
|
9
|
+
var messageId = 'noUnsafeTypographyProperties';
|
|
10
|
+
var BannedProperty = exports.BannedProperty = {
|
|
11
|
+
lint: function lint(node, _ref) {
|
|
12
|
+
var context = _ref.context;
|
|
13
|
+
context.report({
|
|
14
|
+
node: node,
|
|
15
|
+
messageId: messageId
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BannedProperty", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _bannedProperty.BannedProperty;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _bannedProperty = require("./banned-property");
|
|
@@ -60,7 +60,8 @@ export const ObjectEntry = {
|
|
|
60
60
|
return undefined;
|
|
61
61
|
}
|
|
62
62
|
if (isNodeOfType(node.key, 'Literal')) {
|
|
63
|
-
|
|
63
|
+
var _node$key$value;
|
|
64
|
+
return (_node$key$value = node.key.value) === null || _node$key$value === void 0 ? void 0 : _node$key$value.toString();
|
|
64
65
|
}
|
|
65
66
|
if (isNodeOfType(node.key, 'Identifier')) {
|
|
66
67
|
return node.key.name;
|
|
@@ -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::9bb5329713677543f16019954484ae2f>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -38,6 +38,7 @@ export default {
|
|
|
38
38
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
39
39
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
40
40
|
'@atlaskit/design-system/use-latest-xcss-syntax': 'error',
|
|
41
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': 'warn',
|
|
41
42
|
'@atlaskit/design-system/use-menu-section-title': 'warn',
|
|
42
43
|
'@atlaskit/design-system/use-popup-label': 'warn',
|
|
43
44
|
'@atlaskit/design-system/use-primitives': '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::76bee1648b1b78d3ad253f0704a9cac7>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -28,6 +28,7 @@ export default {
|
|
|
28
28
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
29
29
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
30
30
|
'@atlaskit/design-system/use-latest-xcss-syntax': 'error',
|
|
31
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': 'warn',
|
|
31
32
|
'@atlaskit/design-system/use-menu-section-title': 'warn',
|
|
32
33
|
'@atlaskit/design-system/use-popup-label': 'warn',
|
|
33
34
|
'@atlaskit/design-system/use-visually-hidden': 'error'
|
|
@@ -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::b359d356c482db0087ddfce5bd105403>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import consistentCssPropUsage from './consistent-css-prop-usage';
|
|
@@ -35,6 +35,7 @@ import useHeading from './use-heading';
|
|
|
35
35
|
import useHeadingLevelInSpotlightCard from './use-heading-level-in-spotlight-card';
|
|
36
36
|
import useHrefInLinkItem from './use-href-in-link-item';
|
|
37
37
|
import useLatestXcssSyntax from './use-latest-xcss-syntax';
|
|
38
|
+
import useLatestXcssSyntaxTypography from './use-latest-xcss-syntax-typography';
|
|
38
39
|
import useMenuSectionTitle from './use-menu-section-title';
|
|
39
40
|
import usePopupLabel from './use-popup-label';
|
|
40
41
|
import usePrimitives from './use-primitives';
|
|
@@ -75,6 +76,7 @@ export default {
|
|
|
75
76
|
'use-heading-level-in-spotlight-card': useHeadingLevelInSpotlightCard,
|
|
76
77
|
'use-href-in-link-item': useHrefInLinkItem,
|
|
77
78
|
'use-latest-xcss-syntax': useLatestXcssSyntax,
|
|
79
|
+
'use-latest-xcss-syntax-typography': useLatestXcssSyntaxTypography,
|
|
78
80
|
'use-menu-section-title': useMenuSectionTitle,
|
|
79
81
|
'use-popup-label': usePopupLabel,
|
|
80
82
|
'use-primitives': usePrimitives,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createLintRule } from '../utils/create-rule';
|
|
2
|
+
import { BannedProperty } from './linters';
|
|
3
|
+
export const error = `Don't set fontSize, lineHeight, fontWeight properties on xcss. They are unsafe as they allow invalid combinations of typography tokens. There is ongoing work to make this a TypeScript error. Once that happens, you will have to delete/refactor anyway.`;
|
|
4
|
+
const rule = createLintRule({
|
|
5
|
+
meta: {
|
|
6
|
+
name: 'use-latest-xcss-syntax-typography',
|
|
7
|
+
type: 'problem',
|
|
8
|
+
fixable: 'code',
|
|
9
|
+
hasSuggestions: false,
|
|
10
|
+
docs: {
|
|
11
|
+
description: 'Prohibits use of unsafe styling properties in xcss. Please use Text/Heading primitives instead.',
|
|
12
|
+
recommended: true,
|
|
13
|
+
severity: 'warn'
|
|
14
|
+
},
|
|
15
|
+
messages: {
|
|
16
|
+
noUnsafeTypographyProperties: error
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
create(context) {
|
|
20
|
+
return {
|
|
21
|
+
'CallExpression[callee.name="xcss"] ObjectExpression > Property > Identifier[name=/(fontSize|lineHeight|fontWeight)/]': node => BannedProperty.lint(node, {
|
|
22
|
+
context
|
|
23
|
+
}),
|
|
24
|
+
'CallExpression[callee.name="xcss"] ObjectExpression > Property > Literal[value=/(fontSize|lineHeight|fontWeight)/]': node => BannedProperty.lint(node, {
|
|
25
|
+
context
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export default rule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BannedProperty } from './banned-property';
|
|
@@ -60,7 +60,8 @@ export var ObjectEntry = {
|
|
|
60
60
|
return undefined;
|
|
61
61
|
}
|
|
62
62
|
if (isNodeOfType(node.key, 'Literal')) {
|
|
63
|
-
|
|
63
|
+
var _node$key$value;
|
|
64
|
+
return (_node$key$value = node.key.value) === null || _node$key$value === void 0 ? void 0 : _node$key$value.toString();
|
|
64
65
|
}
|
|
65
66
|
if (isNodeOfType(node.key, 'Identifier')) {
|
|
66
67
|
return node.key.name;
|
|
@@ -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::9bb5329713677543f16019954484ae2f>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -38,6 +38,7 @@ export default {
|
|
|
38
38
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
39
39
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
40
40
|
'@atlaskit/design-system/use-latest-xcss-syntax': 'error',
|
|
41
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': 'warn',
|
|
41
42
|
'@atlaskit/design-system/use-menu-section-title': 'warn',
|
|
42
43
|
'@atlaskit/design-system/use-popup-label': 'warn',
|
|
43
44
|
'@atlaskit/design-system/use-primitives': '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::76bee1648b1b78d3ad253f0704a9cac7>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -28,6 +28,7 @@ export default {
|
|
|
28
28
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
|
|
29
29
|
'@atlaskit/design-system/use-href-in-link-item': 'warn',
|
|
30
30
|
'@atlaskit/design-system/use-latest-xcss-syntax': 'error',
|
|
31
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': 'warn',
|
|
31
32
|
'@atlaskit/design-system/use-menu-section-title': 'warn',
|
|
32
33
|
'@atlaskit/design-system/use-popup-label': 'warn',
|
|
33
34
|
'@atlaskit/design-system/use-visually-hidden': 'error'
|
|
@@ -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::b359d356c482db0087ddfce5bd105403>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import consistentCssPropUsage from './consistent-css-prop-usage';
|
|
@@ -35,6 +35,7 @@ import useHeading from './use-heading';
|
|
|
35
35
|
import useHeadingLevelInSpotlightCard from './use-heading-level-in-spotlight-card';
|
|
36
36
|
import useHrefInLinkItem from './use-href-in-link-item';
|
|
37
37
|
import useLatestXcssSyntax from './use-latest-xcss-syntax';
|
|
38
|
+
import useLatestXcssSyntaxTypography from './use-latest-xcss-syntax-typography';
|
|
38
39
|
import useMenuSectionTitle from './use-menu-section-title';
|
|
39
40
|
import usePopupLabel from './use-popup-label';
|
|
40
41
|
import usePrimitives from './use-primitives';
|
|
@@ -75,6 +76,7 @@ export default {
|
|
|
75
76
|
'use-heading-level-in-spotlight-card': useHeadingLevelInSpotlightCard,
|
|
76
77
|
'use-href-in-link-item': useHrefInLinkItem,
|
|
77
78
|
'use-latest-xcss-syntax': useLatestXcssSyntax,
|
|
79
|
+
'use-latest-xcss-syntax-typography': useLatestXcssSyntaxTypography,
|
|
78
80
|
'use-menu-section-title': useMenuSectionTitle,
|
|
79
81
|
'use-popup-label': usePopupLabel,
|
|
80
82
|
'use-primitives': usePrimitives,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createLintRule } from '../utils/create-rule';
|
|
2
|
+
import { BannedProperty } from './linters';
|
|
3
|
+
export var error = "Don't set fontSize, lineHeight, fontWeight properties on xcss. They are unsafe as they allow invalid combinations of typography tokens. There is ongoing work to make this a TypeScript error. Once that happens, you will have to delete/refactor anyway.";
|
|
4
|
+
var rule = createLintRule({
|
|
5
|
+
meta: {
|
|
6
|
+
name: 'use-latest-xcss-syntax-typography',
|
|
7
|
+
type: 'problem',
|
|
8
|
+
fixable: 'code',
|
|
9
|
+
hasSuggestions: false,
|
|
10
|
+
docs: {
|
|
11
|
+
description: 'Prohibits use of unsafe styling properties in xcss. Please use Text/Heading primitives instead.',
|
|
12
|
+
recommended: true,
|
|
13
|
+
severity: 'warn'
|
|
14
|
+
},
|
|
15
|
+
messages: {
|
|
16
|
+
noUnsafeTypographyProperties: error
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
create: function create(context) {
|
|
20
|
+
return {
|
|
21
|
+
'CallExpression[callee.name="xcss"] ObjectExpression > Property > Identifier[name=/(fontSize|lineHeight|fontWeight)/]': function CallExpressionCalleeNameXcssObjectExpressionPropertyIdentifierNameFontSizeLineHeightFontWeight(node) {
|
|
22
|
+
return BannedProperty.lint(node, {
|
|
23
|
+
context: context
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
'CallExpression[callee.name="xcss"] ObjectExpression > Property > Literal[value=/(fontSize|lineHeight|fontWeight)/]': function CallExpressionCalleeNameXcssObjectExpressionPropertyLiteralValueFontSizeLineHeightFontWeight(node) {
|
|
27
|
+
return BannedProperty.lint(node, {
|
|
28
|
+
context: context
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
export default rule;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
|
+
|
|
3
|
+
var messageId = 'noUnsafeTypographyProperties';
|
|
4
|
+
export var BannedProperty = {
|
|
5
|
+
lint: function lint(node, _ref) {
|
|
6
|
+
var context = _ref.context;
|
|
7
|
+
context.report({
|
|
8
|
+
node: node,
|
|
9
|
+
messageId: messageId
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BannedProperty } from './banned-property';
|
|
@@ -35,6 +35,7 @@ export declare const configs: {
|
|
|
35
35
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
36
36
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
37
37
|
'@atlaskit/design-system/use-latest-xcss-syntax': string;
|
|
38
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': string;
|
|
38
39
|
'@atlaskit/design-system/use-menu-section-title': string;
|
|
39
40
|
'@atlaskit/design-system/use-popup-label': string;
|
|
40
41
|
'@atlaskit/design-system/use-primitives': string;
|
|
@@ -69,6 +70,7 @@ export declare const configs: {
|
|
|
69
70
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
70
71
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
71
72
|
'@atlaskit/design-system/use-latest-xcss-syntax': string;
|
|
73
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': string;
|
|
72
74
|
'@atlaskit/design-system/use-menu-section-title': string;
|
|
73
75
|
'@atlaskit/design-system/use-popup-label': string;
|
|
74
76
|
'@atlaskit/design-system/use-visually-hidden': 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::
|
|
3
|
+
* @codegen <<SignedSource::9bb5329713677543f16019954484ae2f>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -38,6 +38,7 @@ declare const _default: {
|
|
|
38
38
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
39
39
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
40
40
|
'@atlaskit/design-system/use-latest-xcss-syntax': string;
|
|
41
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': string;
|
|
41
42
|
'@atlaskit/design-system/use-menu-section-title': string;
|
|
42
43
|
'@atlaskit/design-system/use-popup-label': string;
|
|
43
44
|
'@atlaskit/design-system/use-primitives': 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::
|
|
3
|
+
* @codegen <<SignedSource::76bee1648b1b78d3ad253f0704a9cac7>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -28,6 +28,7 @@ declare const _default: {
|
|
|
28
28
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
29
29
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
30
30
|
'@atlaskit/design-system/use-latest-xcss-syntax': string;
|
|
31
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': string;
|
|
31
32
|
'@atlaskit/design-system/use-menu-section-title': string;
|
|
32
33
|
'@atlaskit/design-system/use-popup-label': string;
|
|
33
34
|
'@atlaskit/design-system/use-visually-hidden': string;
|
|
@@ -35,6 +35,7 @@ declare const _default: {
|
|
|
35
35
|
'use-heading-level-in-spotlight-card': import("eslint").Rule.RuleModule;
|
|
36
36
|
'use-href-in-link-item': import("eslint").Rule.RuleModule;
|
|
37
37
|
'use-latest-xcss-syntax': import("eslint").Rule.RuleModule;
|
|
38
|
+
'use-latest-xcss-syntax-typography': import("eslint").Rule.RuleModule;
|
|
38
39
|
'use-menu-section-title': import("eslint").Rule.RuleModule;
|
|
39
40
|
'use-popup-label': import("eslint").Rule.RuleModule;
|
|
40
41
|
'use-primitives': import("eslint").Rule.RuleModule;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
export declare const error = "Don't set fontSize, lineHeight, fontWeight properties on xcss. They are unsafe as they allow invalid combinations of typography tokens. There is ongoing work to make this a TypeScript error. Once that happens, you will have to delete/refactor anyway.";
|
|
3
|
+
declare const rule: Rule.RuleModule;
|
|
4
|
+
export default rule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BannedProperty } from './banned-property';
|
|
@@ -35,6 +35,7 @@ export declare const configs: {
|
|
|
35
35
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
36
36
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
37
37
|
'@atlaskit/design-system/use-latest-xcss-syntax': string;
|
|
38
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': string;
|
|
38
39
|
'@atlaskit/design-system/use-menu-section-title': string;
|
|
39
40
|
'@atlaskit/design-system/use-popup-label': string;
|
|
40
41
|
'@atlaskit/design-system/use-primitives': string;
|
|
@@ -69,6 +70,7 @@ export declare const configs: {
|
|
|
69
70
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
70
71
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
71
72
|
'@atlaskit/design-system/use-latest-xcss-syntax': string;
|
|
73
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': string;
|
|
72
74
|
'@atlaskit/design-system/use-menu-section-title': string;
|
|
73
75
|
'@atlaskit/design-system/use-popup-label': string;
|
|
74
76
|
'@atlaskit/design-system/use-visually-hidden': 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::
|
|
3
|
+
* @codegen <<SignedSource::9bb5329713677543f16019954484ae2f>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -38,6 +38,7 @@ declare const _default: {
|
|
|
38
38
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
39
39
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
40
40
|
'@atlaskit/design-system/use-latest-xcss-syntax': string;
|
|
41
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': string;
|
|
41
42
|
'@atlaskit/design-system/use-menu-section-title': string;
|
|
42
43
|
'@atlaskit/design-system/use-popup-label': string;
|
|
43
44
|
'@atlaskit/design-system/use-primitives': 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::
|
|
3
|
+
* @codegen <<SignedSource::76bee1648b1b78d3ad253f0704a9cac7>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -28,6 +28,7 @@ declare const _default: {
|
|
|
28
28
|
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
29
29
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
30
30
|
'@atlaskit/design-system/use-latest-xcss-syntax': string;
|
|
31
|
+
'@atlaskit/design-system/use-latest-xcss-syntax-typography': string;
|
|
31
32
|
'@atlaskit/design-system/use-menu-section-title': string;
|
|
32
33
|
'@atlaskit/design-system/use-popup-label': string;
|
|
33
34
|
'@atlaskit/design-system/use-visually-hidden': string;
|
|
@@ -39,6 +39,7 @@ declare const _default: {
|
|
|
39
39
|
'use-heading-level-in-spotlight-card': import("eslint").Rule.RuleModule;
|
|
40
40
|
'use-href-in-link-item': import("eslint").Rule.RuleModule;
|
|
41
41
|
'use-latest-xcss-syntax': import("eslint").Rule.RuleModule;
|
|
42
|
+
'use-latest-xcss-syntax-typography': import("eslint").Rule.RuleModule;
|
|
42
43
|
'use-menu-section-title': import("eslint").Rule.RuleModule;
|
|
43
44
|
'use-popup-label': import("eslint").Rule.RuleModule;
|
|
44
45
|
'use-primitives': import("eslint").Rule.RuleModule;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
export declare const error = "Don't set fontSize, lineHeight, fontWeight properties on xcss. They are unsafe as they allow invalid combinations of typography tokens. There is ongoing work to make this a TypeScript error. Once that happens, you will have to delete/refactor anyway.";
|
|
3
|
+
declare const rule: Rule.RuleModule;
|
|
4
|
+
export default rule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BannedProperty } from './banned-property';
|
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.8.
|
|
4
|
+
"version": "10.8.1",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"publishConfig": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@af/formatting": "*",
|
|
57
57
|
"@atlaskit/ds-lib": "^2.3.0",
|
|
58
|
-
"@atlaskit/theme": "^12.
|
|
58
|
+
"@atlaskit/theme": "^12.11.0",
|
|
59
59
|
"@atlassian/codegen": "*",
|
|
60
60
|
"@atlassian/eslint-utils": "^0.5.0",
|
|
61
61
|
"@emotion/react": "^11.7.1",
|