@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
|
@@ -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,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';
|
|
@@ -38,6 +38,17 @@ export var StyleObject = {
|
|
|
38
38
|
var fontWeightNode = ASTObject.getEntryByPropertyName(node, 'fontWeight');
|
|
39
39
|
var fontWeightRaw = fontWeightNode && getValueForPropertyNode(fontWeightNode, context);
|
|
40
40
|
|
|
41
|
+
// If fontWeightRaw is a token we find the token name and treat it like a raw value for simplicity.
|
|
42
|
+
// e.g. token('font.weight.bold', '700') ends up as '700' after this if-block.
|
|
43
|
+
// That way the token matching logic still runs and the font weight declaration can be removed and re-added after the main font token.
|
|
44
|
+
if (fontWeightRaw && typeof fontWeightRaw === 'string' && fontWeightRaw.includes('font.weight.')) {
|
|
45
|
+
var _fontWeightRaw$match;
|
|
46
|
+
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'
|
|
47
|
+
if (Object.keys(fontWeightMap).includes(fontWeightTokenSuffix)) {
|
|
48
|
+
fontWeightRaw = fontWeightMap[fontWeightTokenSuffix];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
// If no fontWeight value exists, default to 400 to avoid matching with a bolder token resulting in a visual change
|
|
42
53
|
var fontWeightValue = fontWeightRaw && normaliseValue('fontWeight', fontWeightRaw) || defaultFontWeight;
|
|
43
54
|
fontWeightValue = fontWeightValue.length === 3 ? fontWeightValue : fontWeightMap[fontWeightValue] || defaultFontWeight;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { CallExpression, ObjectExpression } from 'eslint-codemod-utils';
|
|
2
|
+
import { type CallExpression, type ObjectExpression } from 'eslint-codemod-utils';
|
|
3
3
|
export declare const FunctionCall: {
|
|
4
4
|
getName(node: CallExpression): string | undefined;
|
|
5
5
|
updateName(node: CallExpression, newName: string, fixer: Rule.RuleFixer): Rule.Fix;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { JSXAttribute } from 'eslint-codemod-utils';
|
|
2
|
+
import { type JSXAttribute } from 'eslint-codemod-utils';
|
|
3
3
|
declare const HelperJSXAttribute: {
|
|
4
4
|
getName(node: JSXAttribute): string;
|
|
5
5
|
updateName(node: JSXAttribute, name: string, fixer: Rule.RuleFixer): Rule.Fix;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { JSXAttribute, JSXElement, JSXFragment, JSXSpreadAttribute } from 'eslint-codemod-utils';
|
|
2
|
+
import { type JSXAttribute, type JSXElement, type JSXFragment, type JSXSpreadAttribute } from 'eslint-codemod-utils';
|
|
3
3
|
export declare const JSXElementHelper: {
|
|
4
4
|
/**
|
|
5
5
|
* Names of JSXElements can be any of:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { Property, SpreadElement } from 'eslint-codemod-utils';
|
|
2
|
+
import { type Property, type SpreadElement } from 'eslint-codemod-utils';
|
|
3
3
|
export declare const ObjectEntry: {
|
|
4
4
|
getProperty(node: Property): {
|
|
5
5
|
type: 'Identifier';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { ObjectExpression, Property, SpreadElement } from 'eslint-codemod-utils';
|
|
2
|
+
import { type ObjectExpression, type Property, type SpreadElement } from 'eslint-codemod-utils';
|
|
3
3
|
declare const ASTObjectExpression: {
|
|
4
4
|
/**
|
|
5
5
|
* Returns `true` if an object contains a property with the specified name, `false` otherwise.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { Rule } from 'eslint';
|
|
3
|
-
import { Directive, ImportDeclaration, insertImportDeclaration, ModuleDeclaration, Statement } from 'eslint-codemod-utils';
|
|
3
|
+
import { type Directive, type ImportDeclaration, insertImportDeclaration, type ModuleDeclaration, type Statement } from 'eslint-codemod-utils';
|
|
4
4
|
type ImportData = Parameters<typeof insertImportDeclaration>[1];
|
|
5
5
|
export declare const Root: {
|
|
6
6
|
/**
|
|
@@ -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::
|
|
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::
|
|
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
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { Property } from 'eslint-codemod-utils';
|
|
2
|
+
import { type Property } from 'eslint-codemod-utils';
|
|
3
3
|
import { isLegacyElevation } from '../utils/is-elevation';
|
|
4
4
|
import type { RuleConfig } from './types';
|
|
5
5
|
type Suggestion = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EslintNode } from 'eslint-codemod-utils';
|
|
1
|
+
import { type EslintNode } from 'eslint-codemod-utils';
|
|
2
2
|
export declare const radiusValueToToken: any;
|
|
3
3
|
export declare const borderWidthValueToToken: any;
|
|
4
4
|
export declare function isRadiusProperty(propertyName: string): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { ImportDeclaration, Property } from 'eslint-codemod-utils';
|
|
2
|
+
import { type ImportDeclaration, type Property } from 'eslint-codemod-utils';
|
|
3
3
|
import type { RuleConfig } from './types';
|
|
4
4
|
export declare const lintObjectForSpacing: (node: Property, context: Rule.RuleContext, ruleConfig: RuleConfig, fontSize: any, tokenNode: ImportDeclaration | null) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { EslintNode, ObjectExpression, Property, SpreadElement, TaggedTemplateExpression } from 'eslint-codemod-utils';
|
|
3
|
-
import { Domains } from './types';
|
|
2
|
+
import { type EslintNode, type ObjectExpression, type Property, type SpreadElement, type TaggedTemplateExpression } from 'eslint-codemod-utils';
|
|
3
|
+
import { type Domains } from './types';
|
|
4
4
|
export type ProcessedCSSLines = [string, string][];
|
|
5
5
|
export declare function insertTokensImport(fixer: Rule.RuleFixer): Rule.Fix;
|
|
6
6
|
export declare const isSpacingProperty: (propertyName: string) => boolean;
|
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
-
import { DeprecatedConfig } from '../utils/types';
|
|
1
|
+
import { type TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
import { type DeprecatedConfig } from '../utils/types';
|
|
3
3
|
export declare const noDeprecatedJSXAttributeMessageId = "noDeprecatedJSXAttributes";
|
|
4
4
|
export declare const name = "no-deprecated-apis";
|
|
5
5
|
declare const rule: TSESLint.RuleModule<string, [{
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
25
|
* THE SOFTWARE.
|
|
26
26
|
*/
|
|
27
|
-
import { TSESLint } from '@typescript-eslint/utils';
|
|
28
|
-
import { DeprecatedConfig } from '../utils/types';
|
|
27
|
+
import { type TSESLint } from '@typescript-eslint/utils';
|
|
28
|
+
import { type DeprecatedConfig } from '../utils/types';
|
|
29
29
|
export declare const name = "no-deprecated-imports";
|
|
30
30
|
export declare const importNameWithCustomMessageId = "importNameWithCustomMessage";
|
|
31
31
|
export declare const pathWithCustomMessageId = "pathWithCustomMessage";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CallExpression } from 'eslint-codemod-utils';
|
|
1
|
+
import { type CallExpression } from 'eslint-codemod-utils';
|
|
2
2
|
export declare function isBlockedAddEventListener(node: CallExpression): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Property, SpreadElement } from 'eslint-codemod-utils';
|
|
1
|
+
import { type Property, type SpreadElement } from 'eslint-codemod-utils';
|
|
2
2
|
export declare function isBlockedEventBinding(property: Property | SpreadElement): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { JSXElement } from 'eslint-codemod-utils';
|
|
3
|
-
import { RuleConfig } from '../config';
|
|
2
|
+
import { type JSXElement } from 'eslint-codemod-utils';
|
|
3
|
+
import { type RuleConfig } from '../config';
|
|
4
4
|
export type MetaData = {
|
|
5
5
|
context: Rule.RuleContext;
|
|
6
6
|
config: RuleConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule, Scope } from 'eslint';
|
|
2
|
-
import { ImportDeclaration, JSXAttribute } from 'eslint-codemod-utils';
|
|
2
|
+
import { type ImportDeclaration, type JSXAttribute } from 'eslint-codemod-utils';
|
|
3
3
|
export declare const hrefHasInvalidValue: (scope: Scope.Scope, href: JSXAttribute | undefined) => boolean;
|
|
4
4
|
export declare const hasImportOfName: (node: ImportDeclaration, name: string) => boolean;
|
|
5
5
|
export declare const insertButtonItemDefaultImport: (fixer: Rule.RuleFixer, node: ImportDeclaration) => Rule.Fix;
|
|
@@ -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 @@
|
|
|
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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule, Scope } from 'eslint';
|
|
2
|
-
import { JSXOpeningElement } from 'eslint-codemod-utils';
|
|
2
|
+
import { type JSXOpeningElement } from 'eslint-codemod-utils';
|
|
3
3
|
/**
|
|
4
4
|
* Given a component name finds its JSX usages and performs some
|
|
5
5
|
* additional validations to ensure transformation can be done correctly
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { JSXElement, VariableDeclarator } from 'eslint-codemod-utils';
|
|
3
|
-
import { RuleConfig } from '../../config';
|
|
2
|
+
import { type JSXElement, type VariableDeclarator } from 'eslint-codemod-utils';
|
|
3
|
+
import { type RuleConfig } from '../../config';
|
|
4
4
|
interface MetaData {
|
|
5
5
|
context: Rule.RuleContext;
|
|
6
6
|
config: RuleConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { JSXElement } from 'eslint-codemod-utils';
|
|
3
|
-
import { RuleConfig } from '../../config';
|
|
2
|
+
import { type JSXElement } from 'eslint-codemod-utils';
|
|
3
|
+
import { type RuleConfig } from '../../config';
|
|
4
4
|
interface MetaData {
|
|
5
5
|
context: Rule.RuleContext;
|
|
6
6
|
config: RuleConfig;
|
package/dist/types/rules/use-primitives/utils/convert-ast-object-expression-to-js-object.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
import type { Rule } from 'eslint';
|
|
3
|
-
import { ObjectExpression } from 'eslint-codemod-utils';
|
|
3
|
+
import { type ObjectExpression } from 'eslint-codemod-utils';
|
|
4
4
|
export declare const SPREAD_SYNTAX: unique symbol;
|
|
5
5
|
type Token = {
|
|
6
6
|
tokenName: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSXAttribute } from 'eslint-codemod-utils';
|
|
1
|
+
import { type JSXAttribute } from 'eslint-codemod-utils';
|
|
2
2
|
/**
|
|
3
3
|
* Bit of a weird name, but the functionality is quite specific, so this is the best I could do.
|
|
4
4
|
* This function looks at a JSXAttribute, and returns the string representation
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { JSXAttribute, JSXOpeningElement } from 'eslint-codemod-utils';
|
|
1
|
+
import { type JSXAttribute, type JSXOpeningElement } from 'eslint-codemod-utils';
|
|
2
2
|
export declare const getJSXAttributeByName: (node: JSXOpeningElement, attrName: string) => JSXAttribute | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { SimpleCallExpression } from 'eslint-codemod-utils';
|
|
3
|
-
import { RuleConfig } from '../config';
|
|
2
|
+
import { type SimpleCallExpression } from 'eslint-codemod-utils';
|
|
3
|
+
import { type RuleConfig } from '../config';
|
|
4
4
|
export declare const isValidCssPropertiesToTransform: (node: SimpleCallExpression & Rule.NodeParentExtension, config: RuleConfig) => boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { JSXElement } from 'eslint-codemod-utils';
|
|
2
|
+
import { type JSXElement } from 'eslint-codemod-utils';
|
|
3
3
|
export declare const updateJSXAttributeByName: (oldName: string, newName: string, node: JSXElement, fixer: Rule.RuleFixer) => Rule.Fix | never[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { CallExpression } from 'eslint-codemod-utils';
|
|
2
|
-
import { RuleConfig } from '../config';
|
|
1
|
+
import { type CallExpression } from 'eslint-codemod-utils';
|
|
2
|
+
import { type RuleConfig } from '../config';
|
|
3
3
|
export declare const validateStyles: (node: CallExpression, config: RuleConfig) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { JSXElement } from 'eslint-codemod-utils';
|
|
3
|
-
import { RuleConfig } from '../config';
|
|
2
|
+
import { type JSXElement } from 'eslint-codemod-utils';
|
|
3
|
+
import { type RuleConfig } from '../config';
|
|
4
4
|
export type MetaData = {
|
|
5
5
|
context: Rule.RuleContext;
|
|
6
6
|
config: RuleConfig;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { ImportDeclaration, ObjectExpression, Property, StringableASTNode } from 'eslint-codemod-utils';
|
|
3
|
-
import { RuleConfig } from '../config';
|
|
4
|
-
import { TokenValueMap } from '../utils';
|
|
2
|
+
import { type ImportDeclaration, type ObjectExpression, type Property, type StringableASTNode } from 'eslint-codemod-utils';
|
|
3
|
+
import { type RuleConfig } from '../config';
|
|
4
|
+
import { type TokenValueMap } from '../utils';
|
|
5
5
|
interface MetaData {
|
|
6
6
|
context: Rule.RuleContext;
|
|
7
7
|
config: RuleConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { CallExpression, Directive, EslintNode, ImportDeclaration, ModuleDeclaration, Property, Statement, StringableASTNode } from 'eslint-codemod-utils';
|
|
2
|
+
import { type CallExpression, type Directive, type EslintNode, type ImportDeclaration, type ModuleDeclaration, type Property, type Statement, type StringableASTNode } from 'eslint-codemod-utils';
|
|
3
3
|
export declare const typographyProperties: string[];
|
|
4
4
|
export declare const isTypographyProperty: (propertyName: string) => boolean;
|
|
5
5
|
export declare const isFontSize: (node: EslintNode) => node is CallExpression;
|