@atlaskit/eslint-plugin-design-system 10.22.0 → 10.23.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +1 -0
  3. package/dist/cjs/index.codegen.js +44 -10
  4. package/dist/cjs/index.js +29 -2
  5. package/dist/cjs/presets/all-flat.codegen.js +61 -0
  6. package/dist/cjs/presets/all.codegen.js +2 -1
  7. package/dist/cjs/presets/recommended-flat.codegen.js +45 -0
  8. package/dist/cjs/presets/recommended.codegen.js +2 -1
  9. package/dist/cjs/rules/ensure-design-token-usage/color.js +1 -1
  10. package/dist/cjs/rules/index.codegen.js +6 -3
  11. package/dist/cjs/rules/no-legacy-icons/checks.js +18 -6
  12. package/dist/cjs/rules/no-legacy-icons/helpers.js +4 -7
  13. package/dist/cjs/rules/no-separator-with-list-elements/index.js +62 -0
  14. package/dist/es2019/index.codegen.js +46 -6
  15. package/dist/es2019/index.js +1 -1
  16. package/dist/es2019/presets/all-flat.codegen.js +55 -0
  17. package/dist/es2019/presets/all.codegen.js +2 -1
  18. package/dist/es2019/presets/recommended-flat.codegen.js +39 -0
  19. package/dist/es2019/presets/recommended.codegen.js +2 -1
  20. package/dist/es2019/rules/ensure-design-token-usage/color.js +1 -1
  21. package/dist/es2019/rules/index.codegen.js +4 -2
  22. package/dist/es2019/rules/no-legacy-icons/checks.js +18 -6
  23. package/dist/es2019/rules/no-legacy-icons/helpers.js +3 -6
  24. package/dist/es2019/rules/no-separator-with-list-elements/index.js +50 -0
  25. package/dist/esm/index.codegen.js +44 -6
  26. package/dist/esm/index.js +1 -1
  27. package/dist/esm/presets/all-flat.codegen.js +55 -0
  28. package/dist/esm/presets/all.codegen.js +2 -1
  29. package/dist/esm/presets/recommended-flat.codegen.js +39 -0
  30. package/dist/esm/presets/recommended.codegen.js +2 -1
  31. package/dist/esm/rules/ensure-design-token-usage/color.js +1 -1
  32. package/dist/esm/rules/index.codegen.js +4 -2
  33. package/dist/esm/rules/no-legacy-icons/checks.js +18 -6
  34. package/dist/esm/rules/no-legacy-icons/helpers.js +4 -7
  35. package/dist/esm/rules/no-separator-with-list-elements/index.js +56 -0
  36. package/dist/types/index.codegen.d.ts +508 -77
  37. package/dist/types/index.d.ts +1 -1
  38. package/dist/types/presets/all-flat.codegen.d.ts +55 -0
  39. package/dist/types/presets/all.codegen.d.ts +47 -46
  40. package/dist/types/presets/recommended-flat.codegen.d.ts +39 -0
  41. package/dist/types/presets/recommended.codegen.d.ts +31 -30
  42. package/dist/types/rules/index.codegen.d.ts +2 -2
  43. package/dist/types/rules/no-legacy-icons/helpers.d.ts +2 -2
  44. package/dist/types/rules/no-separator-with-list-elements/index.d.ts +3 -0
  45. package/dist/types-ts4.5/index.codegen.d.ts +592 -77
  46. package/dist/types-ts4.5/index.d.ts +1 -1
  47. package/dist/types-ts4.5/presets/all-flat.codegen.d.ts +63 -0
  48. package/dist/types-ts4.5/presets/all.codegen.d.ts +57 -46
  49. package/dist/types-ts4.5/presets/recommended-flat.codegen.d.ts +47 -0
  50. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +41 -30
  51. package/dist/types-ts4.5/rules/index.codegen.d.ts +2 -2
  52. package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +2 -2
  53. package/dist/types-ts4.5/rules/no-separator-with-list-elements/index.d.ts +3 -0
  54. package/package.json +6 -4
@@ -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::310e184a1b8eca0da1246cfe8d128e2c>>
3
+ * @codegen <<SignedSource::47f018ad98455be31dc522bcf5360adf>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  export default {
@@ -29,6 +29,7 @@ export default {
29
29
  '@atlaskit/design-system/no-margin': 'warn',
30
30
  '@atlaskit/design-system/no-nested-styles': 'error',
31
31
  '@atlaskit/design-system/no-physical-properties': 'error',
32
+ '@atlaskit/design-system/no-separator-with-list-elements': 'warn',
32
33
  '@atlaskit/design-system/no-styled-tagged-template-expression': 'error',
33
34
  '@atlaskit/design-system/no-unsafe-design-token-usage': 'error',
34
35
  '@atlaskit/design-system/no-unsafe-style-overrides': 'warn',
@@ -0,0 +1,39 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::9c6dda34a88386c4fa5b931ab4baf929>>
4
+ * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
+ */
6
+ export default {
7
+ // NOTE: The reference to this plugin is inserted dynamically while creating the plugin in `index.codegen.tsx`
8
+ plugins: {},
9
+ rules: {
10
+ '@atlaskit/design-system/consistent-css-prop-usage': 'error',
11
+ '@atlaskit/design-system/ensure-design-token-usage': 'error',
12
+ '@atlaskit/design-system/icon-label': 'warn',
13
+ '@atlaskit/design-system/no-banned-imports': 'error',
14
+ '@atlaskit/design-system/no-deprecated-apis': 'error',
15
+ '@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
16
+ '@atlaskit/design-system/no-deprecated-imports': 'error',
17
+ '@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': 'error',
18
+ '@atlaskit/design-system/no-html-anchor': 'warn',
19
+ '@atlaskit/design-system/no-html-button': 'warn',
20
+ '@atlaskit/design-system/no-invalid-css-map': ['error', {
21
+ allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
22
+ }],
23
+ '@atlaskit/design-system/no-nested-styles': 'error',
24
+ '@atlaskit/design-system/no-separator-with-list-elements': 'warn',
25
+ '@atlaskit/design-system/no-unsafe-design-token-usage': 'error',
26
+ '@atlaskit/design-system/no-unsafe-style-overrides': 'warn',
27
+ '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
28
+ '@atlaskit/design-system/use-button-group-label': 'warn',
29
+ '@atlaskit/design-system/use-drawer-label': 'warn',
30
+ '@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
31
+ '@atlaskit/design-system/use-href-in-link-item': 'warn',
32
+ '@atlaskit/design-system/use-latest-xcss-syntax': 'error',
33
+ '@atlaskit/design-system/use-latest-xcss-syntax-typography': 'warn',
34
+ '@atlaskit/design-system/use-menu-section-title': 'warn',
35
+ '@atlaskit/design-system/use-popup-label': 'warn',
36
+ '@atlaskit/design-system/use-tag-group-label': 'warn',
37
+ '@atlaskit/design-system/use-visually-hidden': 'error'
38
+ }
39
+ };
@@ -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::9be7e90918082d78473f5d2a2271b15c>>
3
+ * @codegen <<SignedSource::f1b4aa9e656294739485e62ba4a33f9d>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  export default {
@@ -20,6 +20,7 @@ export default {
20
20
  allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
21
21
  }],
22
22
  '@atlaskit/design-system/no-nested-styles': 'error',
23
+ '@atlaskit/design-system/no-separator-with-list-elements': 'warn',
23
24
  '@atlaskit/design-system/no-unsafe-design-token-usage': 'error',
24
25
  '@atlaskit/design-system/no-unsafe-style-overrides': 'warn',
25
26
  '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
@@ -143,7 +143,7 @@ export const lintJSXLiteralForColor = (node, context, config) => {
143
143
  if (isDecendantOfPrimitive(node.parent, context)) {
144
144
  return;
145
145
  }
146
- if (['alt', 'src', 'label', 'key'].includes(node.parent.name.name)) {
146
+ if (['alt', 'src', 'label', 'key', 'appearance'].includes(node.parent.name.name)) {
147
147
  return;
148
148
  }
149
149
  const isException = getIsException(config.exceptions);
@@ -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::2c61c8c9aa86b4fb1d11e0bcba9d83a1>>
3
+ * @codegen <<SignedSource::2ab06b34c4e08cd70b0f67f5915f12c9>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  import consistentCssPropUsage from './consistent-css-prop-usage';
@@ -27,6 +27,7 @@ import noLegacyIcons from './no-legacy-icons';
27
27
  import noMargin from './no-margin';
28
28
  import noNestedStyles from './no-nested-styles';
29
29
  import noPhysicalProperties from './no-physical-properties';
30
+ import noSeparatorWithListElements from './no-separator-with-list-elements';
30
31
  import noStyledTaggedTemplateExpression from './no-styled-tagged-template-expression';
31
32
  import noUnsafeDesignTokenUsage from './no-unsafe-design-token-usage';
32
33
  import noUnsafeStyleOverrides from './no-unsafe-style-overrides';
@@ -47,7 +48,7 @@ import useTagGroupLabel from './use-tag-group-label';
47
48
  import useTokensSpace from './use-tokens-space';
48
49
  import useTokensTypography from './use-tokens-typography';
49
50
  import useVisuallyHidden from './use-visually-hidden';
50
- export default {
51
+ export const rules = {
51
52
  'consistent-css-prop-usage': consistentCssPropUsage,
52
53
  'ensure-design-token-usage': ensureDesignTokenUsage,
53
54
  'ensure-design-token-usage/preview': ensureDesignTokenUsagePreview,
@@ -72,6 +73,7 @@ export default {
72
73
  'no-margin': noMargin,
73
74
  'no-nested-styles': noNestedStyles,
74
75
  'no-physical-properties': noPhysicalProperties,
76
+ 'no-separator-with-list-elements': noSeparatorWithListElements,
75
77
  'no-styled-tagged-template-expression': noStyledTaggedTemplateExpression,
76
78
  'no-unsafe-design-token-usage': noUnsafeDesignTokenUsage,
77
79
  'no-unsafe-style-overrides': noUnsafeStyleOverrides,
@@ -315,14 +315,14 @@ export const createChecks = context => {
315
315
  importSource: migrationIconImports[name].packageName,
316
316
  iconName: name,
317
317
  errors: errorsAuto,
318
- shouldAddSpaciousSpacing,
318
+ spacing: shouldAddSpaciousSpacing ? 'spacious' : undefined,
319
319
  insideNewButton
320
320
  });
321
321
  }
322
322
 
323
323
  // Legacy icons rendered as JSX elements
324
324
  if (Object.keys(legacyIconImports).includes(name)) {
325
- var _size, _size2, _sizeProp$value2;
325
+ var _size, _size2;
326
326
  // Determine if inside a new button - if so:
327
327
  // - Assume spread props are safe - still error if props explicitly set to unmigratable values
328
328
  const insideNewButton = isInsideNewButton(node, newButtonImports);
@@ -398,18 +398,30 @@ export const createChecks = context => {
398
398
  const newIcon = migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.newIcon;
399
399
  const isNewIconMigratable = canAutoMigrateNewIconBasedOnSize(upcomingIcon ? upcomingIcon.sizeGuidance[(_size = size) !== null && _size !== void 0 ? _size : 'medium'] : migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.sizeGuidance[(_size2 = size) !== null && _size2 !== void 0 ? _size2 : 'medium']);
400
400
 
401
- // Add spacious spacing if:
402
- // 1. size is medium, or not set (default is medium)
401
+ // Add spacing if:
402
+ // 1. size is medium for core/utility icons or small for utility icons, or not set (default is medium for core and small for utility icons)
403
403
  // 2. not inside a new or legacy button
404
404
  const sizeProp = node.openingElement.attributes.find(attribute => attribute.type === 'JSXAttribute' && (attribute.name.name === 'size' || attribute.name.name === 'LEGACY_size'));
405
- const shouldAddSpaciousSpacing = (sizeProp && sizeProp.type === 'JSXAttribute' && ((_sizeProp$value2 = sizeProp.value) === null || _sizeProp$value2 === void 0 ? void 0 : _sizeProp$value2.type) === 'Literal' && sizeProp.value.value === 'medium' || !sizeProp) && !insideNewButton && !insideLegacyButton;
405
+ let spacing;
406
+ if (!insideNewButton && !insideLegacyButton) {
407
+ var _sizeProp$value2;
408
+ if (sizeProp && sizeProp.type === 'JSXAttribute' && ((_sizeProp$value2 = sizeProp.value) === null || _sizeProp$value2 === void 0 ? void 0 : _sizeProp$value2.type) === 'Literal') {
409
+ if (sizeProp.value.value === 'medium') {
410
+ spacing = 'spacious';
411
+ } else if (sizeProp.value.value === 'small' && (newIcon === null || newIcon === void 0 ? void 0 : newIcon.type) === 'utility') {
412
+ spacing = 'compact';
413
+ }
414
+ } else if (!sizeProp) {
415
+ spacing = 'spacious';
416
+ }
417
+ }
406
418
  if (!hasManualMigration && (newIcon || upcomingIcon) && isNewIconMigratable) {
407
419
  createAutoMigrationError({
408
420
  node,
409
421
  importSource: legacyIconImports[name].packageName,
410
422
  iconName: name,
411
423
  errors: errorsAuto,
412
- shouldAddSpaciousSpacing,
424
+ spacing,
413
425
  insideNewButton
414
426
  });
415
427
  } else if ((!newIcon && !upcomingIcon || !isNewIconMigratable) && size) {
@@ -257,7 +257,7 @@ export const createAutoMigrationError = ({
257
257
  importSource,
258
258
  iconName,
259
259
  errors,
260
- shouldAddSpaciousSpacing,
260
+ spacing,
261
261
  insideNewButton
262
262
  }) => {
263
263
  const myError = {
@@ -266,7 +266,7 @@ export const createAutoMigrationError = ({
266
266
  data: {
267
267
  importSource,
268
268
  iconName,
269
- spacing: shouldAddSpaciousSpacing ? 'spacious' : '',
269
+ spacing: spacing !== null && spacing !== void 0 ? spacing : '',
270
270
  // value type need to be a string in Rule.ReportDescriptor
271
271
  insideNewButton: String(insideNewButton)
272
272
  }
@@ -462,15 +462,12 @@ const createPropFixes = ({
462
462
  }) => {
463
463
  const fixes = [];
464
464
  const {
465
- importSource,
466
465
  spacing,
467
466
  insideNewButton
468
467
  } = metadata;
469
468
  if (shouldUseMigrationPath && !legacyImportNode) {
470
469
  return fixes;
471
470
  }
472
- const importPath = migrationImportNode ? importSource.replace('/migration', '').split('--')[0] : getNewIconNameAndImportPath(importSource, shouldUseMigrationPath).importPath;
473
- const iconType = importPath !== null && importPath !== void 0 && importPath.startsWith('@atlaskit/icon/core') ? 'core' : 'utility';
474
471
  if (node.type === 'JSXElement') {
475
472
  const {
476
473
  openingElement
@@ -506,7 +503,7 @@ const createPropFixes = ({
506
503
  // 4. icon is not imported from migration entrypoint
507
504
  const sizeProp = findProp(attributes, 'size');
508
505
  const spacingProp = findProp(attributes, 'spacing');
509
- if (spacing && !spacingProp && iconType === 'core' && !migrationImportNode) {
506
+ if (spacing && !spacingProp && !migrationImportNode) {
510
507
  fixes.push(fixer.insertTextAfter(sizeProp || openingElement.name, ` spacing="${spacing}"`));
511
508
  }
512
509
  if (sizeProp && sizeProp.type === 'JSXAttribute') {
@@ -0,0 +1,50 @@
1
+ import { isNodeOfType } from 'eslint-codemod-utils';
2
+ import { createLintRule } from '../utils/create-rule';
3
+ const separatorAsCombinationNotAllowed = 'The combination of `separator` with `as="li"`, `as="ol"`, or `as="dl"` is not allowed.';
4
+ const rule = createLintRule({
5
+ meta: {
6
+ name: 'no-separator-with-list-elements',
7
+ type: 'suggestion',
8
+ docs: {
9
+ description: 'Warn when the `separator` prop is used with `as="li"`, `as="ol"`, or `as="dl"` in the Inline component.',
10
+ recommended: true,
11
+ severity: 'warn'
12
+ },
13
+ messages: {
14
+ separatorAsCombinationNotAllowed
15
+ }
16
+ },
17
+ create(context) {
18
+ const inlineComponentNames = [];
19
+ return {
20
+ ImportDeclaration(node) {
21
+ if (node.type === 'ImportDeclaration' && (node.source.value === '../src' || node.source.value === '@atlaskit/primitives')) {
22
+ node.specifiers.forEach(specifier => {
23
+ if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'Inline') {
24
+ inlineComponentNames.push(specifier.local.name);
25
+ }
26
+ });
27
+ }
28
+ },
29
+ JSXElement(node) {
30
+ if (!isNodeOfType(node, 'JSXElement') || !isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
31
+ return;
32
+ }
33
+ const componentName = node.openingElement.name.name;
34
+ if (!inlineComponentNames.includes(componentName)) {
35
+ return;
36
+ }
37
+ const inlineProps = node.openingElement.attributes.filter(attr => isNodeOfType(attr, 'JSXAttribute') && isNodeOfType(attr.name, 'JSXIdentifier'));
38
+ const separatorProp = inlineProps.find(attr => attr.name.name === 'separator');
39
+ const asProp = inlineProps.find(attr => attr.name.name === 'as');
40
+ if (separatorProp && asProp && asProp.value && isNodeOfType(asProp.value, 'Literal') && ['li', 'ol', 'dl'].includes(asProp.value.value)) {
41
+ context.report({
42
+ node: node,
43
+ messageId: 'separatorAsCombinationNotAllowed'
44
+ });
45
+ }
46
+ }
47
+ };
48
+ }
49
+ });
50
+ export default rule;
@@ -1,12 +1,50 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
4
  /**
2
5
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::abdb6f8b0dfdc4e2489691c04488f46e>>
6
+ * @codegen <<SignedSource::7656123b732a9145dedb7f9eee588883>>
4
7
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
8
  */
9
+ import allFlat from './presets/all-flat.codegen';
6
10
  import all from './presets/all.codegen';
11
+ import recommendedFlat from './presets/recommended-flat.codegen';
7
12
  import recommended from './presets/recommended.codegen';
8
- export { default as rules } from './rules/index.codegen';
9
- export var configs = {
10
- all: all,
11
- recommended: recommended
12
- };
13
+ import { rules } from './rules/index.codegen';
14
+
15
+ // this uses require because not all node versions this package supports use the same import assertions/attributes
16
+ var pkgJson = require('../package.json');
17
+ var version = pkgJson.version,
18
+ name = pkgJson.name;
19
+ export { version, name };
20
+ export var plugin = {
21
+ meta: {
22
+ name: name,
23
+ version: version
24
+ },
25
+ rules: rules,
26
+ // flat configs need to be done like this so they can get a reference to the plugin.
27
+ // see here: https://eslint.org/docs/latest/extend/plugins#configs-in-plugins
28
+ // they cannot use `Object.assign` because it will not work with the getter
29
+ configs: {
30
+ all: all,
31
+ 'all/flat': _objectSpread(_objectSpread({}, allFlat), {}, {
32
+ plugins: _objectSpread(_objectSpread({}, allFlat.plugins), {}, {
33
+ get '@atlaskit/design-system'() {
34
+ return plugin;
35
+ }
36
+ })
37
+ }),
38
+ recommended: recommended,
39
+ 'recommended/flat': _objectSpread(_objectSpread({}, recommendedFlat), {}, {
40
+ plugins: _objectSpread(_objectSpread({}, recommendedFlat.plugins), {}, {
41
+ get '@atlaskit/design-system'() {
42
+ return plugin;
43
+ }
44
+ })
45
+ })
46
+ }
47
+ };
48
+ export { rules } from './rules/index.codegen';
49
+ export var configs = plugin.configs;
50
+ export default plugin;
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { configs, rules } from './index.codegen';
1
+ export { version, name, rules, plugin, configs, default } from './index.codegen';
2
2
  export { filterActionableDeprecations } from './rules/no-deprecated-apis/helpers/filter-actionable-deprecations';
@@ -0,0 +1,55 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::56a9d309ec6f548dce4a4f6e99059a15>>
4
+ * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
+ */
6
+ export default {
7
+ // NOTE: The reference to this plugin is inserted dynamically while creating the plugin in `index.codegen.tsx`
8
+ plugins: {},
9
+ rules: {
10
+ '@atlaskit/design-system/consistent-css-prop-usage': 'error',
11
+ '@atlaskit/design-system/ensure-design-token-usage': 'error',
12
+ '@atlaskit/design-system/ensure-design-token-usage/preview': 'warn',
13
+ '@atlaskit/design-system/ensure-icon-color': 'error',
14
+ '@atlaskit/design-system/icon-label': 'warn',
15
+ '@atlaskit/design-system/no-banned-imports': 'error',
16
+ '@atlaskit/design-system/no-css-tagged-template-expression': 'error',
17
+ '@atlaskit/design-system/no-custom-icons': 'warn',
18
+ '@atlaskit/design-system/no-dark-theme-vr-tests': 'error',
19
+ '@atlaskit/design-system/no-deprecated-apis': 'error',
20
+ '@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
21
+ '@atlaskit/design-system/no-deprecated-imports': 'error',
22
+ '@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': 'error',
23
+ '@atlaskit/design-system/no-html-anchor': 'warn',
24
+ '@atlaskit/design-system/no-html-button': 'warn',
25
+ '@atlaskit/design-system/no-invalid-css-map': ['error', {
26
+ allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
27
+ }],
28
+ '@atlaskit/design-system/no-keyframes-tagged-template-expression': 'error',
29
+ '@atlaskit/design-system/no-legacy-icons': 'warn',
30
+ '@atlaskit/design-system/no-margin': 'warn',
31
+ '@atlaskit/design-system/no-nested-styles': 'error',
32
+ '@atlaskit/design-system/no-physical-properties': 'error',
33
+ '@atlaskit/design-system/no-separator-with-list-elements': 'warn',
34
+ '@atlaskit/design-system/no-styled-tagged-template-expression': 'error',
35
+ '@atlaskit/design-system/no-unsafe-design-token-usage': 'error',
36
+ '@atlaskit/design-system/no-unsafe-style-overrides': 'warn',
37
+ '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
38
+ '@atlaskit/design-system/prefer-primitives': 'warn',
39
+ '@atlaskit/design-system/use-button-group-label': 'warn',
40
+ '@atlaskit/design-system/use-drawer-label': 'warn',
41
+ '@atlaskit/design-system/use-heading': 'warn',
42
+ '@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
43
+ '@atlaskit/design-system/use-href-in-link-item': 'warn',
44
+ '@atlaskit/design-system/use-latest-xcss-syntax': 'error',
45
+ '@atlaskit/design-system/use-latest-xcss-syntax-typography': 'warn',
46
+ '@atlaskit/design-system/use-menu-section-title': 'warn',
47
+ '@atlaskit/design-system/use-popup-label': 'warn',
48
+ '@atlaskit/design-system/use-primitives': 'warn',
49
+ '@atlaskit/design-system/use-primitives-text': 'warn',
50
+ '@atlaskit/design-system/use-tag-group-label': 'warn',
51
+ '@atlaskit/design-system/use-tokens-space': 'error',
52
+ '@atlaskit/design-system/use-tokens-typography': 'warn',
53
+ '@atlaskit/design-system/use-visually-hidden': 'error'
54
+ }
55
+ };
@@ -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::310e184a1b8eca0da1246cfe8d128e2c>>
3
+ * @codegen <<SignedSource::47f018ad98455be31dc522bcf5360adf>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  export default {
@@ -29,6 +29,7 @@ export default {
29
29
  '@atlaskit/design-system/no-margin': 'warn',
30
30
  '@atlaskit/design-system/no-nested-styles': 'error',
31
31
  '@atlaskit/design-system/no-physical-properties': 'error',
32
+ '@atlaskit/design-system/no-separator-with-list-elements': 'warn',
32
33
  '@atlaskit/design-system/no-styled-tagged-template-expression': 'error',
33
34
  '@atlaskit/design-system/no-unsafe-design-token-usage': 'error',
34
35
  '@atlaskit/design-system/no-unsafe-style-overrides': 'warn',
@@ -0,0 +1,39 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::9c6dda34a88386c4fa5b931ab4baf929>>
4
+ * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
+ */
6
+ export default {
7
+ // NOTE: The reference to this plugin is inserted dynamically while creating the plugin in `index.codegen.tsx`
8
+ plugins: {},
9
+ rules: {
10
+ '@atlaskit/design-system/consistent-css-prop-usage': 'error',
11
+ '@atlaskit/design-system/ensure-design-token-usage': 'error',
12
+ '@atlaskit/design-system/icon-label': 'warn',
13
+ '@atlaskit/design-system/no-banned-imports': 'error',
14
+ '@atlaskit/design-system/no-deprecated-apis': 'error',
15
+ '@atlaskit/design-system/no-deprecated-design-token-usage': 'warn',
16
+ '@atlaskit/design-system/no-deprecated-imports': 'error',
17
+ '@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': 'error',
18
+ '@atlaskit/design-system/no-html-anchor': 'warn',
19
+ '@atlaskit/design-system/no-html-button': 'warn',
20
+ '@atlaskit/design-system/no-invalid-css-map': ['error', {
21
+ allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
22
+ }],
23
+ '@atlaskit/design-system/no-nested-styles': 'error',
24
+ '@atlaskit/design-system/no-separator-with-list-elements': 'warn',
25
+ '@atlaskit/design-system/no-unsafe-design-token-usage': 'error',
26
+ '@atlaskit/design-system/no-unsafe-style-overrides': 'warn',
27
+ '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
28
+ '@atlaskit/design-system/use-button-group-label': 'warn',
29
+ '@atlaskit/design-system/use-drawer-label': 'warn',
30
+ '@atlaskit/design-system/use-heading-level-in-spotlight-card': 'warn',
31
+ '@atlaskit/design-system/use-href-in-link-item': 'warn',
32
+ '@atlaskit/design-system/use-latest-xcss-syntax': 'error',
33
+ '@atlaskit/design-system/use-latest-xcss-syntax-typography': 'warn',
34
+ '@atlaskit/design-system/use-menu-section-title': 'warn',
35
+ '@atlaskit/design-system/use-popup-label': 'warn',
36
+ '@atlaskit/design-system/use-tag-group-label': 'warn',
37
+ '@atlaskit/design-system/use-visually-hidden': 'error'
38
+ }
39
+ };
@@ -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::9be7e90918082d78473f5d2a2271b15c>>
3
+ * @codegen <<SignedSource::f1b4aa9e656294739485e62ba4a33f9d>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  export default {
@@ -20,6 +20,7 @@ export default {
20
20
  allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
21
21
  }],
22
22
  '@atlaskit/design-system/no-nested-styles': 'error',
23
+ '@atlaskit/design-system/no-separator-with-list-elements': 'warn',
23
24
  '@atlaskit/design-system/no-unsafe-design-token-usage': 'error',
24
25
  '@atlaskit/design-system/no-unsafe-style-overrides': 'warn',
25
26
  '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': 'error',
@@ -142,7 +142,7 @@ export var lintJSXLiteralForColor = function lintJSXLiteralForColor(node, contex
142
142
  if (isDecendantOfPrimitive(node.parent, context)) {
143
143
  return;
144
144
  }
145
- if (['alt', 'src', 'label', 'key'].includes(node.parent.name.name)) {
145
+ if (['alt', 'src', 'label', 'key', 'appearance'].includes(node.parent.name.name)) {
146
146
  return;
147
147
  }
148
148
  var isException = getIsException(config.exceptions);
@@ -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::2c61c8c9aa86b4fb1d11e0bcba9d83a1>>
3
+ * @codegen <<SignedSource::2ab06b34c4e08cd70b0f67f5915f12c9>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  import consistentCssPropUsage from './consistent-css-prop-usage';
@@ -27,6 +27,7 @@ import noLegacyIcons from './no-legacy-icons';
27
27
  import noMargin from './no-margin';
28
28
  import noNestedStyles from './no-nested-styles';
29
29
  import noPhysicalProperties from './no-physical-properties';
30
+ import noSeparatorWithListElements from './no-separator-with-list-elements';
30
31
  import noStyledTaggedTemplateExpression from './no-styled-tagged-template-expression';
31
32
  import noUnsafeDesignTokenUsage from './no-unsafe-design-token-usage';
32
33
  import noUnsafeStyleOverrides from './no-unsafe-style-overrides';
@@ -47,7 +48,7 @@ import useTagGroupLabel from './use-tag-group-label';
47
48
  import useTokensSpace from './use-tokens-space';
48
49
  import useTokensTypography from './use-tokens-typography';
49
50
  import useVisuallyHidden from './use-visually-hidden';
50
- export default {
51
+ export var rules = {
51
52
  'consistent-css-prop-usage': consistentCssPropUsage,
52
53
  'ensure-design-token-usage': ensureDesignTokenUsage,
53
54
  'ensure-design-token-usage/preview': ensureDesignTokenUsagePreview,
@@ -72,6 +73,7 @@ export default {
72
73
  'no-margin': noMargin,
73
74
  'no-nested-styles': noNestedStyles,
74
75
  'no-physical-properties': noPhysicalProperties,
76
+ 'no-separator-with-list-elements': noSeparatorWithListElements,
75
77
  'no-styled-tagged-template-expression': noStyledTaggedTemplateExpression,
76
78
  'no-unsafe-design-token-usage': noUnsafeDesignTokenUsage,
77
79
  'no-unsafe-style-overrides': noUnsafeStyleOverrides,
@@ -386,14 +386,14 @@ export var createChecks = function createChecks(context) {
386
386
  importSource: migrationIconImports[name].packageName,
387
387
  iconName: name,
388
388
  errors: errorsAuto,
389
- shouldAddSpaciousSpacing: shouldAddSpaciousSpacing,
389
+ spacing: shouldAddSpaciousSpacing ? 'spacious' : undefined,
390
390
  insideNewButton: insideNewButton
391
391
  });
392
392
  }
393
393
 
394
394
  // Legacy icons rendered as JSX elements
395
395
  if (Object.keys(legacyIconImports).includes(name)) {
396
- var _size, _size2, _sizeProp$value2;
396
+ var _size, _size2;
397
397
  // Determine if inside a new button - if so:
398
398
  // - Assume spread props are safe - still error if props explicitly set to unmigratable values
399
399
  var _insideNewButton = isInsideNewButton(node, newButtonImports);
@@ -482,20 +482,32 @@ export var createChecks = function createChecks(context) {
482
482
  var newIcon = migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.newIcon;
483
483
  var isNewIconMigratable = canAutoMigrateNewIconBasedOnSize(upcomingIcon ? upcomingIcon.sizeGuidance[(_size = size) !== null && _size !== void 0 ? _size : 'medium'] : migrationMapObject === null || migrationMapObject === void 0 ? void 0 : migrationMapObject.sizeGuidance[(_size2 = size) !== null && _size2 !== void 0 ? _size2 : 'medium']);
484
484
 
485
- // Add spacious spacing if:
486
- // 1. size is medium, or not set (default is medium)
485
+ // Add spacing if:
486
+ // 1. size is medium for core/utility icons or small for utility icons, or not set (default is medium for core and small for utility icons)
487
487
  // 2. not inside a new or legacy button
488
488
  var _sizeProp = node.openingElement.attributes.find(function (attribute) {
489
489
  return attribute.type === 'JSXAttribute' && (attribute.name.name === 'size' || attribute.name.name === 'LEGACY_size');
490
490
  });
491
- var _shouldAddSpaciousSpacing = (_sizeProp && _sizeProp.type === 'JSXAttribute' && ((_sizeProp$value2 = _sizeProp.value) === null || _sizeProp$value2 === void 0 ? void 0 : _sizeProp$value2.type) === 'Literal' && _sizeProp.value.value === 'medium' || !_sizeProp) && !_insideNewButton && !insideLegacyButton;
491
+ var spacing;
492
+ if (!_insideNewButton && !insideLegacyButton) {
493
+ var _sizeProp$value2;
494
+ if (_sizeProp && _sizeProp.type === 'JSXAttribute' && ((_sizeProp$value2 = _sizeProp.value) === null || _sizeProp$value2 === void 0 ? void 0 : _sizeProp$value2.type) === 'Literal') {
495
+ if (_sizeProp.value.value === 'medium') {
496
+ spacing = 'spacious';
497
+ } else if (_sizeProp.value.value === 'small' && (newIcon === null || newIcon === void 0 ? void 0 : newIcon.type) === 'utility') {
498
+ spacing = 'compact';
499
+ }
500
+ } else if (!_sizeProp) {
501
+ spacing = 'spacious';
502
+ }
503
+ }
492
504
  if (!hasManualMigration && (newIcon || upcomingIcon) && isNewIconMigratable) {
493
505
  createAutoMigrationError({
494
506
  node: node,
495
507
  importSource: legacyIconImports[name].packageName,
496
508
  iconName: name,
497
509
  errors: errorsAuto,
498
- shouldAddSpaciousSpacing: _shouldAddSpaciousSpacing,
510
+ spacing: spacing,
499
511
  insideNewButton: _insideNewButton
500
512
  });
501
513
  } else if ((!newIcon && !upcomingIcon || !isNewIconMigratable) && size) {
@@ -269,7 +269,7 @@ export var createAutoMigrationError = function createAutoMigrationError(_ref4) {
269
269
  importSource = _ref4.importSource,
270
270
  iconName = _ref4.iconName,
271
271
  errors = _ref4.errors,
272
- shouldAddSpaciousSpacing = _ref4.shouldAddSpaciousSpacing,
272
+ spacing = _ref4.spacing,
273
273
  insideNewButton = _ref4.insideNewButton;
274
274
  var myError = {
275
275
  node: node,
@@ -277,7 +277,7 @@ export var createAutoMigrationError = function createAutoMigrationError(_ref4) {
277
277
  data: {
278
278
  importSource: importSource,
279
279
  iconName: iconName,
280
- spacing: shouldAddSpaciousSpacing ? 'spacious' : '',
280
+ spacing: spacing !== null && spacing !== void 0 ? spacing : '',
281
281
  // value type need to be a string in Rule.ReportDescriptor
282
282
  insideNewButton: String(insideNewButton)
283
283
  }
@@ -470,14 +470,11 @@ var createPropFixes = function createPropFixes(_ref7) {
470
470
  migrationImportNode = _ref7.migrationImportNode,
471
471
  newIconName = _ref7.newIconName;
472
472
  var fixes = [];
473
- var importSource = metadata.importSource,
474
- spacing = metadata.spacing,
473
+ var spacing = metadata.spacing,
475
474
  insideNewButton = metadata.insideNewButton;
476
475
  if (shouldUseMigrationPath && !legacyImportNode) {
477
476
  return fixes;
478
477
  }
479
- var importPath = migrationImportNode ? importSource.replace('/migration', '').split('--')[0] : getNewIconNameAndImportPath(importSource, shouldUseMigrationPath).importPath;
480
- var iconType = importPath !== null && importPath !== void 0 && importPath.startsWith('@atlaskit/icon/core') ? 'core' : 'utility';
481
478
  if (node.type === 'JSXElement') {
482
479
  var openingElement = node.openingElement;
483
480
  if (newIconName) {
@@ -509,7 +506,7 @@ var createPropFixes = function createPropFixes(_ref7) {
509
506
  // 4. icon is not imported from migration entrypoint
510
507
  var sizeProp = findProp(attributes, 'size');
511
508
  var spacingProp = findProp(attributes, 'spacing');
512
- if (spacing && !spacingProp && iconType === 'core' && !migrationImportNode) {
509
+ if (spacing && !spacingProp && !migrationImportNode) {
513
510
  fixes.push(fixer.insertTextAfter(sizeProp || openingElement.name, " spacing=\"".concat(spacing, "\"")));
514
511
  }
515
512
  if (sizeProp && sizeProp.type === 'JSXAttribute') {