@atlaskit/eslint-plugin-design-system 10.7.2 → 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 +18 -0
- package/README.md +1 -0
- package/configs/deprecated.json +270 -266
- 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/configs/deprecated.json +270 -266
- 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
|
@@ -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");
|