@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.
Files changed (42) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +1 -0
  3. package/configs/deprecated.json +270 -266
  4. package/constellation/index/usage.mdx +1 -0
  5. package/constellation/use-latest-xcss-syntax-typography/usage.mdx +34 -0
  6. package/dist/cjs/ast-nodes/object-entry.js +2 -1
  7. package/dist/cjs/presets/all.codegen.js +2 -1
  8. package/dist/cjs/presets/recommended.codegen.js +2 -1
  9. package/dist/cjs/rules/index.codegen.js +3 -1
  10. package/dist/cjs/rules/use-latest-xcss-syntax-typography/index.js +40 -0
  11. package/dist/cjs/rules/use-latest-xcss-syntax-typography/linters/banned-property/index.js +18 -0
  12. package/dist/cjs/rules/use-latest-xcss-syntax-typography/linters/index.js +12 -0
  13. package/dist/configs/deprecated.json +270 -266
  14. package/dist/es2019/ast-nodes/object-entry.js +2 -1
  15. package/dist/es2019/presets/all.codegen.js +2 -1
  16. package/dist/es2019/presets/recommended.codegen.js +2 -1
  17. package/dist/es2019/rules/index.codegen.js +3 -1
  18. package/dist/es2019/rules/use-latest-xcss-syntax-typography/index.js +30 -0
  19. package/dist/es2019/rules/use-latest-xcss-syntax-typography/linters/banned-property/index.js +13 -0
  20. package/dist/es2019/rules/use-latest-xcss-syntax-typography/linters/index.js +1 -0
  21. package/dist/esm/ast-nodes/object-entry.js +2 -1
  22. package/dist/esm/presets/all.codegen.js +2 -1
  23. package/dist/esm/presets/recommended.codegen.js +2 -1
  24. package/dist/esm/rules/index.codegen.js +3 -1
  25. package/dist/esm/rules/use-latest-xcss-syntax-typography/index.js +34 -0
  26. package/dist/esm/rules/use-latest-xcss-syntax-typography/linters/banned-property/index.js +12 -0
  27. package/dist/esm/rules/use-latest-xcss-syntax-typography/linters/index.js +1 -0
  28. package/dist/types/index.codegen.d.ts +2 -0
  29. package/dist/types/presets/all.codegen.d.ts +2 -1
  30. package/dist/types/presets/recommended.codegen.d.ts +2 -1
  31. package/dist/types/rules/index.codegen.d.ts +1 -0
  32. package/dist/types/rules/use-latest-xcss-syntax-typography/index.d.ts +4 -0
  33. package/dist/types/rules/use-latest-xcss-syntax-typography/linters/banned-property/index.d.ts +6 -0
  34. package/dist/types/rules/use-latest-xcss-syntax-typography/linters/index.d.ts +1 -0
  35. package/dist/types-ts4.5/index.codegen.d.ts +2 -0
  36. package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
  37. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +2 -1
  38. package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
  39. package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/index.d.ts +4 -0
  40. package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/linters/banned-property/index.d.ts +6 -0
  41. package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/linters/index.d.ts +1 -0
  42. package/package.json +2 -2
@@ -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,13 @@
1
+ /* eslint-disable @repo/internal/react/require-jsdoc */
2
+
3
+ const messageId = 'noUnsafeTypographyProperties';
4
+ export const BannedProperty = {
5
+ lint(node, {
6
+ context
7
+ }) {
8
+ context.report({
9
+ node,
10
+ messageId
11
+ });
12
+ }
13
+ };
@@ -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
- return node.key.raw;
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::837556032f39113ae86785a120bb9ccb>>
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::b7ed527a03208f0bc68f9d34e4ef2260>>
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::287628b11d396c2bcbcf6f4a175a3d3a>>
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::837556032f39113ae86785a120bb9ccb>>
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::b7ed527a03208f0bc68f9d34e4ef2260>>
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,6 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const BannedProperty: {
3
+ lint(node: Rule.Node, { context }: {
4
+ context: Rule.RuleContext;
5
+ }): void;
6
+ };
@@ -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::837556032f39113ae86785a120bb9ccb>>
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::b7ed527a03208f0bc68f9d34e4ef2260>>
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,6 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const BannedProperty: {
3
+ lint(node: Rule.Node, { context }: {
4
+ context: Rule.RuleContext;
5
+ }): void;
6
+ };
@@ -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.7.2",
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.10.0",
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",