@atlaskit/eslint-plugin-design-system 13.41.1 → 13.41.2

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 13.41.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5e06fddfce409`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5e06fddfce409) -
8
+ Rename codemod to `next-icon-spacing-to-flex-primitive` (now discoverable via
9
+ `npx @atlaskit/codemod-cli`) and update `no-icon-spacing-prop` ESLint rule to generate `Flex`
10
+ wrapper instead of `Box`.
11
+ - Updated dependencies
12
+
3
13
  ## 13.41.1
4
14
 
5
15
  ### Patch Changes
package/README.md CHANGED
@@ -82,7 +82,7 @@ module.exports = {
82
82
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-html-select/README.md">no-html-select</a> | Discourage direct usage of HTML select elements in favor of the Atlassian Design System select component. | Yes | | Yes |
83
83
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-html-text-input/README.md">no-html-text-input</a> | Discourage direct usage of HTML text input elements in favor of the Atlassian Design System textfield component. | Yes | | Yes |
84
84
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-html-textarea/README.md">no-html-textarea</a> | Discourage direct usage of HTML textarea elements in favor of the Atlassian Design System textarea component. | Yes | | Yes |
85
- | <a href="./packages/design-system/eslint-plugin/src/rules/no-icon-spacing-prop/README.md">no-icon-spacing-prop</a> | Disallows usage of the deprecated spacing prop on new icons. Use Box with cssMap for spacing instead. | Yes | | Yes |
85
+ | <a href="./packages/design-system/eslint-plugin/src/rules/no-icon-spacing-prop/README.md">no-icon-spacing-prop</a> | Disallows usage of the deprecated spacing prop on new icons. Use Flex with cssMap for spacing instead. | Yes | | Yes |
86
86
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-invalid-css-map/README.md">no-invalid-css-map</a> | Checks the validity of a CSS map created through cssMap. This is intended to be used alongside TypeScript's type-checking. | Yes | | |
87
87
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-keyframes-tagged-template-expression/README.md">no-keyframes-tagged-template-expression</a> | Disallows any `keyframe` tagged template expressions that originate from Emotion, Styled Components or Compiled | | Yes | |
88
88
  | <a href="./packages/design-system/eslint-plugin/src/rules/no-legacy-icons/README.md">no-legacy-icons</a> | Enforces no legacy icons are used. | | Yes | Yes |
@@ -33,6 +33,8 @@ var _tokensRaw = require("@atlaskit/tokens/tokens-raw");
33
33
  var _findInParent = require("../utils/find-in-parent");
34
34
  var _isColor = require("../utils/is-color");
35
35
  var _shape = require("./shape");
36
+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
37
+
36
38
  var properties = ['padding', 'paddingBlock', 'paddingInline', 'paddingLeft', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd', 'marginLeft', 'marginTop', 'marginRight', 'marginBottom', 'marginInline', 'marginInlineStart', 'marginInlineEnd', 'marginBlock', 'marginBlockStart', 'marginBlockEnd', 'margin', 'gap', 'rowGap', 'gridRowGap', 'columnGap', 'gridColumnGap', 'top', 'left', 'right', 'bottom', 'inlineStart', 'inlineEnd', 'blockStart', 'blockEnd', 'outline-offset'];
37
39
  var spacingValueToToken = Object.fromEntries(_tokensRaw.spacing.map(function (token) {
38
40
  return [token.value, token.cleanName];
@@ -5,15 +5,15 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.TOKEN_IMPORT_MODULE = exports.SPACING_TO_PADDING = exports.CSS_IMPORT_MODULE = exports.CSSMAP_VARIABLE_NAME = exports.BOX_IMPORT_MODULE_NON_COMPILED = exports.BOX_IMPORT_MODULE = void 0;
8
+ exports.TOKEN_IMPORT_MODULE = exports.SPACING_TO_PADDING = exports.FLEX_IMPORT_MODULE_NON_COMPILED = exports.FLEX_IMPORT_MODULE = exports.CSS_IMPORT_MODULE = exports.CSSMAP_VARIABLE_NAME = void 0;
9
9
  exports.getCssMapKey = getCssMapKey;
10
10
  exports.getIconSize = getIconSize;
11
11
  exports.getSpacingAttribute = getSpacingAttribute;
12
12
  exports.getStaticAttributeValue = getStaticAttributeValue;
13
13
  exports.hasSpreadProps = hasSpreadProps;
14
- exports.upsertBoxImport = upsertBoxImport;
15
14
  exports.upsertCssMapImport = upsertCssMapImport;
16
15
  exports.upsertCssMapVariable = upsertCssMapVariable;
16
+ exports.upsertFlexImport = upsertFlexImport;
17
17
  exports.upsertTokenImport = upsertTokenImport;
18
18
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
19
19
  var _eslintCodemodUtils = require("eslint-codemod-utils");
@@ -21,8 +21,8 @@ var _contextCompat = require("@atlaskit/eslint-utils/context-compat");
21
21
  var ast = _interopRequireWildcard(require("../../ast-nodes"));
22
22
  var _import = require("../../ast-nodes/import");
23
23
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
24
- var BOX_IMPORT_MODULE = exports.BOX_IMPORT_MODULE = '@atlaskit/primitives/compiled';
25
- var BOX_IMPORT_MODULE_NON_COMPILED = exports.BOX_IMPORT_MODULE_NON_COMPILED = '@atlaskit/primitives';
24
+ var FLEX_IMPORT_MODULE = exports.FLEX_IMPORT_MODULE = '@atlaskit/primitives/compiled';
25
+ var FLEX_IMPORT_MODULE_NON_COMPILED = exports.FLEX_IMPORT_MODULE_NON_COMPILED = '@atlaskit/primitives';
26
26
  var TOKEN_IMPORT_MODULE = exports.TOKEN_IMPORT_MODULE = '@atlaskit/tokens';
27
27
  var CSS_IMPORT_MODULE = exports.CSS_IMPORT_MODULE = '@atlaskit/css';
28
28
  var CSSMAP_VARIABLE_NAME = exports.CSSMAP_VARIABLE_NAME = 'iconSpacingStyles';
@@ -98,22 +98,22 @@ function hasSpreadProps(node) {
98
98
  }
99
99
 
100
100
  /**
101
- * Upserts `Box` from `@atlaskit/primitives/compiled`, handling:
102
- * 1. Already imported from `/compiled` → add Box if missing
103
- * 2. Import from `@atlaskit/primitives` (non-compiled) → migrate path + add Box
104
- * 3. No import → insert new `import { Box } from '@atlaskit/primitives/compiled'`
101
+ * Upserts `Flex` from `@atlaskit/primitives/compiled`, handling:
102
+ * 1. Already imported from `/compiled` → add Flex if missing
103
+ * 2. Import from `@atlaskit/primitives` (non-compiled) → migrate path + add Flex
104
+ * 3. No import → insert new `import { Flex } from '@atlaskit/primitives/compiled'`
105
105
  */
106
- function upsertBoxImport(context, fixer) {
106
+ function upsertFlexImport(context, fixer) {
107
107
  var root = (0, _contextCompat.getSourceCode)(context).ast.body;
108
108
  var findExactImports = function findExactImports(module) {
109
109
  return root.filter(function (node) {
110
110
  return node.type === 'ImportDeclaration' && node.source.value === module;
111
111
  });
112
112
  };
113
- var compiledImports = findExactImports(BOX_IMPORT_MODULE);
113
+ var compiledImports = findExactImports(FLEX_IMPORT_MODULE);
114
114
  if (compiledImports.length > 0) {
115
115
  var decl = compiledImports[0];
116
- if (_import.Import.containsNamedSpecifier(decl, 'Box')) {
116
+ if (_import.Import.containsNamedSpecifier(decl, 'Flex')) {
117
117
  return undefined;
118
118
  }
119
119
  var specifiers = decl.specifiers.filter(function (s) {
@@ -121,10 +121,10 @@ function upsertBoxImport(context, fixer) {
121
121
  }).map(function (s) {
122
122
  return s.local.name;
123
123
  });
124
- specifiers.push('Box');
125
- return fixer.replaceText(decl, "import { ".concat(specifiers.join(', '), " } from '").concat(BOX_IMPORT_MODULE, "';"));
124
+ specifiers.push('Flex');
125
+ return fixer.replaceText(decl, "import { ".concat(specifiers.join(', '), " } from '").concat(FLEX_IMPORT_MODULE, "';"));
126
126
  }
127
- var nonCompiledImports = findExactImports(BOX_IMPORT_MODULE_NON_COMPILED);
127
+ var nonCompiledImports = findExactImports(FLEX_IMPORT_MODULE_NON_COMPILED);
128
128
  if (nonCompiledImports.length > 0) {
129
129
  var _decl = nonCompiledImports[0];
130
130
  var _specifiers = _decl.specifiers.filter(function (s) {
@@ -132,12 +132,14 @@ function upsertBoxImport(context, fixer) {
132
132
  }).map(function (s) {
133
133
  return s.local.name;
134
134
  });
135
- if (!_specifiers.includes('Box')) _specifiers.push('Box');
136
- return fixer.replaceText(_decl, "import { ".concat(_specifiers.join(', '), " } from '").concat(BOX_IMPORT_MODULE, "';"));
135
+ if (!_specifiers.includes('Flex')) {
136
+ _specifiers.push('Flex');
137
+ }
138
+ return fixer.replaceText(_decl, "import { ".concat(_specifiers.join(', '), " } from '").concat(FLEX_IMPORT_MODULE, "';"));
137
139
  }
138
140
  return ast.Root.upsertNamedImportDeclaration({
139
- module: BOX_IMPORT_MODULE,
140
- specifiers: ['Box']
141
+ module: FLEX_IMPORT_MODULE,
142
+ specifiers: ['Flex']
141
143
  }, context, fixer);
142
144
  }
143
145
 
@@ -163,7 +165,9 @@ function upsertCssMapImport(context, fixer) {
163
165
  }).map(function (s) {
164
166
  return s.local.name;
165
167
  });
166
- if (!hasCssMap) specifiers.push('cssMap');
168
+ if (!hasCssMap) {
169
+ specifiers.push('cssMap');
170
+ }
167
171
  return fixer.replaceText(decl, "import { ".concat(specifiers.join(', '), " } from '").concat(CSS_IMPORT_MODULE, "';"));
168
172
  }
169
173
  return ast.Root.upsertNamedImportDeclaration({
@@ -213,7 +217,7 @@ function upsertCssMapVariable(context, fixer, paddingToken) {
213
217
  var sourceCode = (0, _contextCompat.getSourceCode)(context);
214
218
  var body = sourceCode.ast.body;
215
219
  var key = getCssMapKey(paddingToken);
216
- var keyValuePair = " ".concat(key, ": { paddingTop: token('").concat(paddingToken, "'), paddingRight: token('").concat(paddingToken, "'), paddingBottom: token('").concat(paddingToken, "'), paddingLeft: token('").concat(paddingToken, "') }");
220
+ var keyValuePair = " ".concat(key, ": { paddingBlock: token('").concat(paddingToken, "'), paddingInline: token('").concat(paddingToken, "') }");
217
221
 
218
222
  // Check if iconSpacingStyles cssMap variable already exists
219
223
  var existingVar = body.find(function (node) {
@@ -14,19 +14,19 @@ var rule = (0, _createRule.createLintRule)({
14
14
  hasSuggestions: true,
15
15
  type: 'suggestion',
16
16
  docs: {
17
- description: 'Disallows usage of the deprecated spacing prop on new icons. Use Box with cssMap for spacing instead.',
17
+ description: 'Disallows usage of the deprecated spacing prop on new icons. Use Flex with cssMap for spacing instead.',
18
18
  recommended: true,
19
19
  severity: 'warn'
20
20
  },
21
21
  messages: {
22
- noSpacingProp: "The `spacing` prop on icon component '{{iconName}}' is deprecated. Wrap the icon in a `<Box xcss={iconSpacingStyles.spaceXXX}>` using `cssMap` from `@atlaskit/css` instead.",
23
- noSpacingPropManual: "The `spacing` prop on icon component '{{iconName}}' is deprecated but cannot be auto-fixed ({{reason}}). Manually wrap the icon in a `<Box xcss={...}>` using `cssMap` from `@atlaskit/css`.",
22
+ noSpacingProp: "The `spacing` prop on icon component '{{iconName}}' is deprecated. Wrap the icon in a `<Flex xcss={iconSpacingStyles.spaceXXX}>` using `cssMap` from `@atlaskit/css` instead.",
23
+ noSpacingPropManual: "The `spacing` prop on icon component '{{iconName}}' is deprecated but cannot be auto-fixed ({{reason}}). Manually wrap the icon in a `<Flex xcss={...}>` using `cssMap` from `@atlaskit/css`.",
24
24
  suggestRemoveSpacing: 'Remove the `spacing` prop.',
25
- suggestWrapInBox: 'Wrap in `<Box xcss={{{cssMapVarName}}.{{cssMapKey}}}>` and remove the `spacing` prop.'
25
+ suggestWrapInFlex: 'Wrap in `<Flex xcss={{{cssMapVarName}}.{{cssMapKey}}}>` and remove the `spacing` prop.'
26
26
  }
27
27
  },
28
28
  create: function create(context) {
29
- var isNewIcon = (0, _isFromImportSource.createIsFromImportSourceFor)(/^@(atlaskit\/icon|atlaskit\/icon-lab|atlassian\/icon-private)\/core\//);
29
+ var isNewIcon = (0, _isFromImportSource.createIsFromImportSourceFor)(/^@(atlaskit\/icon|atlaskit\/icon-lab)\/core\//);
30
30
  return (0, _errorBoundary.errorBoundary)({
31
31
  JSXElement: function JSXElement(node) {
32
32
  var _SPACING_TO_PADDING$s;
@@ -89,7 +89,7 @@ var rule = (0, _createRule.createLintRule)({
89
89
  iconName: iconName
90
90
  },
91
91
  suggest: [{
92
- messageId: 'suggestWrapInBox',
92
+ messageId: 'suggestWrapInFlex',
93
93
  data: {
94
94
  cssMapVarName: _helpers.CSSMAP_VARIABLE_NAME,
95
95
  cssMapKey: cssMapKey
@@ -100,9 +100,9 @@ var rule = (0, _createRule.createLintRule)({
100
100
  // 1. Remove spacing prop
101
101
  fixes.push(fixer.remove(spacingAttr));
102
102
 
103
- // 2. Wrap in Box with cssMap reference
104
- fixes.push(fixer.insertTextBefore(node, "<Box xcss={".concat(_helpers.CSSMAP_VARIABLE_NAME, ".").concat(cssMapKey, "}>")));
105
- fixes.push(fixer.insertTextAfter(node, "</Box>"));
103
+ // 2. Wrap in Flex with cssMap reference
104
+ fixes.push(fixer.insertTextBefore(node, "<Flex xcss={".concat(_helpers.CSSMAP_VARIABLE_NAME, ".").concat(cssMapKey, "}>")));
105
+ fixes.push(fixer.insertTextAfter(node, "</Flex>"));
106
106
 
107
107
  // 3. Insert/update cssMap variable after last import
108
108
  var cssMapFix = (0, _helpers.upsertCssMapVariable)(context, fixer, paddingToken);
@@ -116,10 +116,10 @@ var rule = (0, _createRule.createLintRule)({
116
116
  fixes.push(cssFix);
117
117
  }
118
118
 
119
- // 5. Add Box to @atlaskit/primitives/compiled
120
- var boxFix = (0, _helpers.upsertBoxImport)(context, fixer);
121
- if (boxFix) {
122
- fixes.push(boxFix);
119
+ // 5. Add Flex to @atlaskit/primitives/compiled
120
+ var flexFix = (0, _helpers.upsertFlexImport)(context, fixer);
121
+ if (flexFix) {
122
+ fixes.push(flexFix);
123
123
  }
124
124
 
125
125
  // 6. Add token from @atlaskit/tokens
@@ -1,3 +1,4 @@
1
+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
1
2
  import { callExpression, identifier, insertAtStartOfFile, insertImportDeclaration, isNodeOfType, literal } from 'eslint-codemod-utils';
2
3
  import { getScope, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
3
4
  import { spacing as spacingScale } from '@atlaskit/tokens/tokens-raw';
@@ -2,8 +2,8 @@ import { isNodeOfType } from 'eslint-codemod-utils';
2
2
  import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
3
3
  import * as ast from '../../ast-nodes';
4
4
  import { Import } from '../../ast-nodes/import';
5
- export const BOX_IMPORT_MODULE = '@atlaskit/primitives/compiled';
6
- export const BOX_IMPORT_MODULE_NON_COMPILED = '@atlaskit/primitives';
5
+ export const FLEX_IMPORT_MODULE = '@atlaskit/primitives/compiled';
6
+ export const FLEX_IMPORT_MODULE_NON_COMPILED = '@atlaskit/primitives';
7
7
  export const TOKEN_IMPORT_MODULE = '@atlaskit/tokens';
8
8
  export const CSS_IMPORT_MODULE = '@atlaskit/css';
9
9
  export const CSSMAP_VARIABLE_NAME = 'iconSpacingStyles';
@@ -73,34 +73,36 @@ export function hasSpreadProps(node) {
73
73
  }
74
74
 
75
75
  /**
76
- * Upserts `Box` from `@atlaskit/primitives/compiled`, handling:
77
- * 1. Already imported from `/compiled` → add Box if missing
78
- * 2. Import from `@atlaskit/primitives` (non-compiled) → migrate path + add Box
79
- * 3. No import → insert new `import { Box } from '@atlaskit/primitives/compiled'`
76
+ * Upserts `Flex` from `@atlaskit/primitives/compiled`, handling:
77
+ * 1. Already imported from `/compiled` → add Flex if missing
78
+ * 2. Import from `@atlaskit/primitives` (non-compiled) → migrate path + add Flex
79
+ * 3. No import → insert new `import { Flex } from '@atlaskit/primitives/compiled'`
80
80
  */
81
- export function upsertBoxImport(context, fixer) {
81
+ export function upsertFlexImport(context, fixer) {
82
82
  const root = getSourceCode(context).ast.body;
83
83
  const findExactImports = module => root.filter(node => node.type === 'ImportDeclaration' && node.source.value === module);
84
- const compiledImports = findExactImports(BOX_IMPORT_MODULE);
84
+ const compiledImports = findExactImports(FLEX_IMPORT_MODULE);
85
85
  if (compiledImports.length > 0) {
86
86
  const decl = compiledImports[0];
87
- if (Import.containsNamedSpecifier(decl, 'Box')) {
87
+ if (Import.containsNamedSpecifier(decl, 'Flex')) {
88
88
  return undefined;
89
89
  }
90
90
  const specifiers = decl.specifiers.filter(s => s.type === 'ImportSpecifier').map(s => s.local.name);
91
- specifiers.push('Box');
92
- return fixer.replaceText(decl, `import { ${specifiers.join(', ')} } from '${BOX_IMPORT_MODULE}';`);
91
+ specifiers.push('Flex');
92
+ return fixer.replaceText(decl, `import { ${specifiers.join(', ')} } from '${FLEX_IMPORT_MODULE}';`);
93
93
  }
94
- const nonCompiledImports = findExactImports(BOX_IMPORT_MODULE_NON_COMPILED);
94
+ const nonCompiledImports = findExactImports(FLEX_IMPORT_MODULE_NON_COMPILED);
95
95
  if (nonCompiledImports.length > 0) {
96
96
  const decl = nonCompiledImports[0];
97
97
  const specifiers = decl.specifiers.filter(s => s.type === 'ImportSpecifier').map(s => s.local.name);
98
- if (!specifiers.includes('Box')) specifiers.push('Box');
99
- return fixer.replaceText(decl, `import { ${specifiers.join(', ')} } from '${BOX_IMPORT_MODULE}';`);
98
+ if (!specifiers.includes('Flex')) {
99
+ specifiers.push('Flex');
100
+ }
101
+ return fixer.replaceText(decl, `import { ${specifiers.join(', ')} } from '${FLEX_IMPORT_MODULE}';`);
100
102
  }
101
103
  return ast.Root.upsertNamedImportDeclaration({
102
- module: BOX_IMPORT_MODULE,
103
- specifiers: ['Box']
104
+ module: FLEX_IMPORT_MODULE,
105
+ specifiers: ['Flex']
104
106
  }, context, fixer);
105
107
  }
106
108
 
@@ -120,7 +122,9 @@ export function upsertCssMapImport(context, fixer) {
120
122
  return undefined;
121
123
  }
122
124
  const specifiers = decl.specifiers.filter(s => s.type === 'ImportSpecifier').map(s => s.local.name);
123
- if (!hasCssMap) specifiers.push('cssMap');
125
+ if (!hasCssMap) {
126
+ specifiers.push('cssMap');
127
+ }
124
128
  return fixer.replaceText(decl, `import { ${specifiers.join(', ')} } from '${CSS_IMPORT_MODULE}';`);
125
129
  }
126
130
  return ast.Root.upsertNamedImportDeclaration({
@@ -164,7 +168,7 @@ export function upsertCssMapVariable(context, fixer, paddingToken) {
164
168
  const sourceCode = getSourceCode(context);
165
169
  const body = sourceCode.ast.body;
166
170
  const key = getCssMapKey(paddingToken);
167
- const keyValuePair = ` ${key}: { paddingTop: token('${paddingToken}'), paddingRight: token('${paddingToken}'), paddingBottom: token('${paddingToken}'), paddingLeft: token('${paddingToken}') }`;
171
+ const keyValuePair = ` ${key}: { paddingBlock: token('${paddingToken}'), paddingInline: token('${paddingToken}') }`;
168
172
 
169
173
  // Check if iconSpacingStyles cssMap variable already exists
170
174
  const existingVar = body.find(node => {
@@ -1,26 +1,26 @@
1
1
  import { createIsFromImportSourceFor } from '../no-custom-icons/checks/is-from-import-source';
2
2
  import { createLintRule } from '../utils/create-rule';
3
3
  import { errorBoundary } from '../utils/error-boundary';
4
- import { CSSMAP_VARIABLE_NAME, getCssMapKey, getIconSize, getSpacingAttribute, getStaticAttributeValue, hasSpreadProps, SPACING_TO_PADDING, upsertBoxImport, upsertCssMapImport, upsertCssMapVariable, upsertTokenImport } from './helpers';
4
+ import { CSSMAP_VARIABLE_NAME, getCssMapKey, getIconSize, getSpacingAttribute, getStaticAttributeValue, hasSpreadProps, SPACING_TO_PADDING, upsertCssMapImport, upsertCssMapVariable, upsertFlexImport, upsertTokenImport } from './helpers';
5
5
  const rule = createLintRule({
6
6
  meta: {
7
7
  name: 'no-icon-spacing-prop',
8
8
  hasSuggestions: true,
9
9
  type: 'suggestion',
10
10
  docs: {
11
- description: 'Disallows usage of the deprecated spacing prop on new icons. Use Box with cssMap for spacing instead.',
11
+ description: 'Disallows usage of the deprecated spacing prop on new icons. Use Flex with cssMap for spacing instead.',
12
12
  recommended: true,
13
13
  severity: 'warn'
14
14
  },
15
15
  messages: {
16
- noSpacingProp: "The `spacing` prop on icon component '{{iconName}}' is deprecated. Wrap the icon in a `<Box xcss={iconSpacingStyles.spaceXXX}>` using `cssMap` from `@atlaskit/css` instead.",
17
- noSpacingPropManual: "The `spacing` prop on icon component '{{iconName}}' is deprecated but cannot be auto-fixed ({{reason}}). Manually wrap the icon in a `<Box xcss={...}>` using `cssMap` from `@atlaskit/css`.",
16
+ noSpacingProp: "The `spacing` prop on icon component '{{iconName}}' is deprecated. Wrap the icon in a `<Flex xcss={iconSpacingStyles.spaceXXX}>` using `cssMap` from `@atlaskit/css` instead.",
17
+ noSpacingPropManual: "The `spacing` prop on icon component '{{iconName}}' is deprecated but cannot be auto-fixed ({{reason}}). Manually wrap the icon in a `<Flex xcss={...}>` using `cssMap` from `@atlaskit/css`.",
18
18
  suggestRemoveSpacing: 'Remove the `spacing` prop.',
19
- suggestWrapInBox: 'Wrap in `<Box xcss={{{cssMapVarName}}.{{cssMapKey}}}>` and remove the `spacing` prop.'
19
+ suggestWrapInFlex: 'Wrap in `<Flex xcss={{{cssMapVarName}}.{{cssMapKey}}}>` and remove the `spacing` prop.'
20
20
  }
21
21
  },
22
22
  create(context) {
23
- const isNewIcon = createIsFromImportSourceFor(/^@(atlaskit\/icon|atlaskit\/icon-lab|atlassian\/icon-private)\/core\//);
23
+ const isNewIcon = createIsFromImportSourceFor(/^@(atlaskit\/icon|atlaskit\/icon-lab)\/core\//);
24
24
  return errorBoundary({
25
25
  JSXElement(node) {
26
26
  var _SPACING_TO_PADDING$s;
@@ -83,7 +83,7 @@ const rule = createLintRule({
83
83
  iconName
84
84
  },
85
85
  suggest: [{
86
- messageId: 'suggestWrapInBox',
86
+ messageId: 'suggestWrapInFlex',
87
87
  data: {
88
88
  cssMapVarName: CSSMAP_VARIABLE_NAME,
89
89
  cssMapKey
@@ -94,9 +94,9 @@ const rule = createLintRule({
94
94
  // 1. Remove spacing prop
95
95
  fixes.push(fixer.remove(spacingAttr));
96
96
 
97
- // 2. Wrap in Box with cssMap reference
98
- fixes.push(fixer.insertTextBefore(node, `<Box xcss={${CSSMAP_VARIABLE_NAME}.${cssMapKey}}>`));
99
- fixes.push(fixer.insertTextAfter(node, `</Box>`));
97
+ // 2. Wrap in Flex with cssMap reference
98
+ fixes.push(fixer.insertTextBefore(node, `<Flex xcss={${CSSMAP_VARIABLE_NAME}.${cssMapKey}}>`));
99
+ fixes.push(fixer.insertTextAfter(node, `</Flex>`));
100
100
 
101
101
  // 3. Insert/update cssMap variable after last import
102
102
  const cssMapFix = upsertCssMapVariable(context, fixer, paddingToken);
@@ -110,10 +110,10 @@ const rule = createLintRule({
110
110
  fixes.push(cssFix);
111
111
  }
112
112
 
113
- // 5. Add Box to @atlaskit/primitives/compiled
114
- const boxFix = upsertBoxImport(context, fixer);
115
- if (boxFix) {
116
- fixes.push(boxFix);
113
+ // 5. Add Flex to @atlaskit/primitives/compiled
114
+ const flexFix = upsertFlexImport(context, fixer);
115
+ if (flexFix) {
116
+ fixes.push(flexFix);
117
117
  }
118
118
 
119
119
  // 6. Add token from @atlaskit/tokens
@@ -1,4 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
2
3
  import { callExpression, identifier, insertAtStartOfFile, insertImportDeclaration, isNodeOfType, literal } from 'eslint-codemod-utils';
3
4
  import { getScope, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
4
5
  import { spacing as spacingScale } from '@atlaskit/tokens/tokens-raw';
@@ -3,8 +3,8 @@ import { isNodeOfType } from 'eslint-codemod-utils';
3
3
  import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
4
4
  import * as ast from '../../ast-nodes';
5
5
  import { Import } from '../../ast-nodes/import';
6
- export var BOX_IMPORT_MODULE = '@atlaskit/primitives/compiled';
7
- export var BOX_IMPORT_MODULE_NON_COMPILED = '@atlaskit/primitives';
6
+ export var FLEX_IMPORT_MODULE = '@atlaskit/primitives/compiled';
7
+ export var FLEX_IMPORT_MODULE_NON_COMPILED = '@atlaskit/primitives';
8
8
  export var TOKEN_IMPORT_MODULE = '@atlaskit/tokens';
9
9
  export var CSS_IMPORT_MODULE = '@atlaskit/css';
10
10
  export var CSSMAP_VARIABLE_NAME = 'iconSpacingStyles';
@@ -80,22 +80,22 @@ export function hasSpreadProps(node) {
80
80
  }
81
81
 
82
82
  /**
83
- * Upserts `Box` from `@atlaskit/primitives/compiled`, handling:
84
- * 1. Already imported from `/compiled` → add Box if missing
85
- * 2. Import from `@atlaskit/primitives` (non-compiled) → migrate path + add Box
86
- * 3. No import → insert new `import { Box } from '@atlaskit/primitives/compiled'`
83
+ * Upserts `Flex` from `@atlaskit/primitives/compiled`, handling:
84
+ * 1. Already imported from `/compiled` → add Flex if missing
85
+ * 2. Import from `@atlaskit/primitives` (non-compiled) → migrate path + add Flex
86
+ * 3. No import → insert new `import { Flex } from '@atlaskit/primitives/compiled'`
87
87
  */
88
- export function upsertBoxImport(context, fixer) {
88
+ export function upsertFlexImport(context, fixer) {
89
89
  var root = getSourceCode(context).ast.body;
90
90
  var findExactImports = function findExactImports(module) {
91
91
  return root.filter(function (node) {
92
92
  return node.type === 'ImportDeclaration' && node.source.value === module;
93
93
  });
94
94
  };
95
- var compiledImports = findExactImports(BOX_IMPORT_MODULE);
95
+ var compiledImports = findExactImports(FLEX_IMPORT_MODULE);
96
96
  if (compiledImports.length > 0) {
97
97
  var decl = compiledImports[0];
98
- if (Import.containsNamedSpecifier(decl, 'Box')) {
98
+ if (Import.containsNamedSpecifier(decl, 'Flex')) {
99
99
  return undefined;
100
100
  }
101
101
  var specifiers = decl.specifiers.filter(function (s) {
@@ -103,10 +103,10 @@ export function upsertBoxImport(context, fixer) {
103
103
  }).map(function (s) {
104
104
  return s.local.name;
105
105
  });
106
- specifiers.push('Box');
107
- return fixer.replaceText(decl, "import { ".concat(specifiers.join(', '), " } from '").concat(BOX_IMPORT_MODULE, "';"));
106
+ specifiers.push('Flex');
107
+ return fixer.replaceText(decl, "import { ".concat(specifiers.join(', '), " } from '").concat(FLEX_IMPORT_MODULE, "';"));
108
108
  }
109
- var nonCompiledImports = findExactImports(BOX_IMPORT_MODULE_NON_COMPILED);
109
+ var nonCompiledImports = findExactImports(FLEX_IMPORT_MODULE_NON_COMPILED);
110
110
  if (nonCompiledImports.length > 0) {
111
111
  var _decl = nonCompiledImports[0];
112
112
  var _specifiers = _decl.specifiers.filter(function (s) {
@@ -114,12 +114,14 @@ export function upsertBoxImport(context, fixer) {
114
114
  }).map(function (s) {
115
115
  return s.local.name;
116
116
  });
117
- if (!_specifiers.includes('Box')) _specifiers.push('Box');
118
- return fixer.replaceText(_decl, "import { ".concat(_specifiers.join(', '), " } from '").concat(BOX_IMPORT_MODULE, "';"));
117
+ if (!_specifiers.includes('Flex')) {
118
+ _specifiers.push('Flex');
119
+ }
120
+ return fixer.replaceText(_decl, "import { ".concat(_specifiers.join(', '), " } from '").concat(FLEX_IMPORT_MODULE, "';"));
119
121
  }
120
122
  return ast.Root.upsertNamedImportDeclaration({
121
- module: BOX_IMPORT_MODULE,
122
- specifiers: ['Box']
123
+ module: FLEX_IMPORT_MODULE,
124
+ specifiers: ['Flex']
123
125
  }, context, fixer);
124
126
  }
125
127
 
@@ -145,7 +147,9 @@ export function upsertCssMapImport(context, fixer) {
145
147
  }).map(function (s) {
146
148
  return s.local.name;
147
149
  });
148
- if (!hasCssMap) specifiers.push('cssMap');
150
+ if (!hasCssMap) {
151
+ specifiers.push('cssMap');
152
+ }
149
153
  return fixer.replaceText(decl, "import { ".concat(specifiers.join(', '), " } from '").concat(CSS_IMPORT_MODULE, "';"));
150
154
  }
151
155
  return ast.Root.upsertNamedImportDeclaration({
@@ -195,7 +199,7 @@ export function upsertCssMapVariable(context, fixer, paddingToken) {
195
199
  var sourceCode = getSourceCode(context);
196
200
  var body = sourceCode.ast.body;
197
201
  var key = getCssMapKey(paddingToken);
198
- var keyValuePair = " ".concat(key, ": { paddingTop: token('").concat(paddingToken, "'), paddingRight: token('").concat(paddingToken, "'), paddingBottom: token('").concat(paddingToken, "'), paddingLeft: token('").concat(paddingToken, "') }");
202
+ var keyValuePair = " ".concat(key, ": { paddingBlock: token('").concat(paddingToken, "'), paddingInline: token('").concat(paddingToken, "') }");
199
203
 
200
204
  // Check if iconSpacingStyles cssMap variable already exists
201
205
  var existingVar = body.find(function (node) {
@@ -1,26 +1,26 @@
1
1
  import { createIsFromImportSourceFor } from '../no-custom-icons/checks/is-from-import-source';
2
2
  import { createLintRule } from '../utils/create-rule';
3
3
  import { errorBoundary } from '../utils/error-boundary';
4
- import { CSSMAP_VARIABLE_NAME, getCssMapKey, getIconSize, getSpacingAttribute, getStaticAttributeValue, hasSpreadProps, SPACING_TO_PADDING, upsertBoxImport, upsertCssMapImport, upsertCssMapVariable, upsertTokenImport } from './helpers';
4
+ import { CSSMAP_VARIABLE_NAME, getCssMapKey, getIconSize, getSpacingAttribute, getStaticAttributeValue, hasSpreadProps, SPACING_TO_PADDING, upsertCssMapImport, upsertCssMapVariable, upsertFlexImport, upsertTokenImport } from './helpers';
5
5
  var rule = createLintRule({
6
6
  meta: {
7
7
  name: 'no-icon-spacing-prop',
8
8
  hasSuggestions: true,
9
9
  type: 'suggestion',
10
10
  docs: {
11
- description: 'Disallows usage of the deprecated spacing prop on new icons. Use Box with cssMap for spacing instead.',
11
+ description: 'Disallows usage of the deprecated spacing prop on new icons. Use Flex with cssMap for spacing instead.',
12
12
  recommended: true,
13
13
  severity: 'warn'
14
14
  },
15
15
  messages: {
16
- noSpacingProp: "The `spacing` prop on icon component '{{iconName}}' is deprecated. Wrap the icon in a `<Box xcss={iconSpacingStyles.spaceXXX}>` using `cssMap` from `@atlaskit/css` instead.",
17
- noSpacingPropManual: "The `spacing` prop on icon component '{{iconName}}' is deprecated but cannot be auto-fixed ({{reason}}). Manually wrap the icon in a `<Box xcss={...}>` using `cssMap` from `@atlaskit/css`.",
16
+ noSpacingProp: "The `spacing` prop on icon component '{{iconName}}' is deprecated. Wrap the icon in a `<Flex xcss={iconSpacingStyles.spaceXXX}>` using `cssMap` from `@atlaskit/css` instead.",
17
+ noSpacingPropManual: "The `spacing` prop on icon component '{{iconName}}' is deprecated but cannot be auto-fixed ({{reason}}). Manually wrap the icon in a `<Flex xcss={...}>` using `cssMap` from `@atlaskit/css`.",
18
18
  suggestRemoveSpacing: 'Remove the `spacing` prop.',
19
- suggestWrapInBox: 'Wrap in `<Box xcss={{{cssMapVarName}}.{{cssMapKey}}}>` and remove the `spacing` prop.'
19
+ suggestWrapInFlex: 'Wrap in `<Flex xcss={{{cssMapVarName}}.{{cssMapKey}}}>` and remove the `spacing` prop.'
20
20
  }
21
21
  },
22
22
  create: function create(context) {
23
- var isNewIcon = createIsFromImportSourceFor(/^@(atlaskit\/icon|atlaskit\/icon-lab|atlassian\/icon-private)\/core\//);
23
+ var isNewIcon = createIsFromImportSourceFor(/^@(atlaskit\/icon|atlaskit\/icon-lab)\/core\//);
24
24
  return errorBoundary({
25
25
  JSXElement: function JSXElement(node) {
26
26
  var _SPACING_TO_PADDING$s;
@@ -83,7 +83,7 @@ var rule = createLintRule({
83
83
  iconName: iconName
84
84
  },
85
85
  suggest: [{
86
- messageId: 'suggestWrapInBox',
86
+ messageId: 'suggestWrapInFlex',
87
87
  data: {
88
88
  cssMapVarName: CSSMAP_VARIABLE_NAME,
89
89
  cssMapKey: cssMapKey
@@ -94,9 +94,9 @@ var rule = createLintRule({
94
94
  // 1. Remove spacing prop
95
95
  fixes.push(fixer.remove(spacingAttr));
96
96
 
97
- // 2. Wrap in Box with cssMap reference
98
- fixes.push(fixer.insertTextBefore(node, "<Box xcss={".concat(CSSMAP_VARIABLE_NAME, ".").concat(cssMapKey, "}>")));
99
- fixes.push(fixer.insertTextAfter(node, "</Box>"));
97
+ // 2. Wrap in Flex with cssMap reference
98
+ fixes.push(fixer.insertTextBefore(node, "<Flex xcss={".concat(CSSMAP_VARIABLE_NAME, ".").concat(cssMapKey, "}>")));
99
+ fixes.push(fixer.insertTextAfter(node, "</Flex>"));
100
100
 
101
101
  // 3. Insert/update cssMap variable after last import
102
102
  var cssMapFix = upsertCssMapVariable(context, fixer, paddingToken);
@@ -110,10 +110,10 @@ var rule = createLintRule({
110
110
  fixes.push(cssFix);
111
111
  }
112
112
 
113
- // 5. Add Box to @atlaskit/primitives/compiled
114
- var boxFix = upsertBoxImport(context, fixer);
115
- if (boxFix) {
116
- fixes.push(boxFix);
113
+ // 5. Add Flex to @atlaskit/primitives/compiled
114
+ var flexFix = upsertFlexImport(context, fixer);
115
+ if (flexFix) {
116
+ fixes.push(flexFix);
117
117
  }
118
118
 
119
119
  // 6. Add token from @atlaskit/tokens
@@ -1,44 +1,44 @@
1
1
  import { type Domains } from './types';
2
2
  declare const ruleMeta: {
3
- readonly name: "ensure-design-token-usage";
3
+ readonly name: 'ensure-design-token-usage';
4
4
  readonly hasSuggestions: true;
5
5
  readonly schema: {
6
- readonly type: "array";
6
+ readonly type: 'array';
7
7
  readonly items: {
8
- readonly type: "object";
8
+ readonly type: 'object';
9
9
  readonly properties: {
10
10
  readonly applyImport: {
11
- readonly type: "boolean";
11
+ readonly type: 'boolean';
12
12
  };
13
13
  readonly shouldEnforceFallbacks: {
14
- readonly type: "boolean";
14
+ readonly type: 'boolean';
15
15
  };
16
16
  readonly domains: {
17
- readonly type: "array";
17
+ readonly type: 'array';
18
18
  readonly items: {
19
19
  readonly enum: Domains;
20
20
  };
21
21
  };
22
22
  readonly exceptions: {
23
- readonly type: "array";
23
+ readonly type: 'array';
24
24
  };
25
25
  };
26
26
  };
27
27
  };
28
- readonly type: "problem";
29
- readonly fixable: "code";
28
+ readonly type: 'problem';
29
+ readonly fixable: 'code';
30
30
  readonly docs: {
31
- readonly description: "Enforces usage of design tokens rather than hard-coded values.";
31
+ readonly description: 'Enforces usage of design tokens rather than hard-coded values.';
32
32
  readonly recommended: true;
33
- readonly severity: "error";
33
+ readonly severity: 'error';
34
34
  };
35
35
  readonly messages: {
36
- readonly noRawRadiusValues: "The use of shape tokens is preferred over the direct application of border properties.\n\n@meta <<{{payload}}>>";
37
- readonly noRawSpacingValues: "The use of spacing primitives or tokens is preferred over the direct application of spacing properties.\n\n@meta <<{{payload}}>>";
38
- readonly autofixesPossible: "Automated corrections available for spacing values. Apply autofix to replace values with appropriate tokens";
39
- readonly noCalcUsage: "The use of space tokens is preferred over using the CSS calc function. If using a value that is not aligned to the spacing scale, consider aligning to the scale and using tokens instead.";
40
- readonly hardCodedColor: "Colors can be sourced from the global theme using the token function.";
41
- readonly legacyElevation: "Elevations can be sourced from the global theme using the token function made of both a background and shadow. Use \"card\" for card elevations, and \"overlay\" for anything else that should appear elevated.";
36
+ readonly noRawRadiusValues: 'The use of shape tokens is preferred over the direct application of border properties.\n\n@meta <<{{payload}}>>';
37
+ readonly noRawSpacingValues: 'The use of spacing primitives or tokens is preferred over the direct application of spacing properties.\n\n@meta <<{{payload}}>>';
38
+ readonly autofixesPossible: 'Automated corrections available for spacing values. Apply autofix to replace values with appropriate tokens';
39
+ readonly noCalcUsage: 'The use of space tokens is preferred over using the CSS calc function. If using a value that is not aligned to the spacing scale, consider aligning to the scale and using tokens instead.';
40
+ readonly hardCodedColor: 'Colors can be sourced from the global theme using the token function.';
41
+ readonly legacyElevation: 'Elevations can be sourced from the global theme using the token function made of both a background and shadow. Use "card" for card elevations, and "overlay" for anything else that should appear elevated.';
42
42
  };
43
43
  };
44
44
  export default ruleMeta;
@@ -1,5 +1,5 @@
1
1
  import type { Rule } from 'eslint';
2
- import { type EslintNode, type ObjectExpression, type Property, type SpreadElement, type TaggedTemplateExpression } from 'eslint-codemod-utils';
2
+ import { type EslintNode, type ObjectExpression, type Property, SimpleCallExpression, type SpreadElement, StringableASTNode, type TaggedTemplateExpression } from 'eslint-codemod-utils';
3
3
  import { type Domains } from './types';
4
4
  export type ProcessedCSSLines = [string, string][];
5
5
  export declare function insertTokensImport(fixer: Rule.RuleFixer): Rule.Fix;
@@ -86,7 +86,7 @@ export declare function processCssNode(node: TaggedTemplateExpression & Rule.Nod
86
86
  * propertyName: fontWeight, value: 400 => token('font.weight.regular', '400')
87
87
  * ```
88
88
  */
89
- export declare function getTokenNodeForValue(propertyName: string, value: string): import("eslint-codemod-utils").StringableASTNode<import("estree").SimpleCallExpression>;
89
+ export declare function getTokenNodeForValue(propertyName: string, value: string): StringableASTNode<SimpleCallExpression>;
90
90
  export declare function getFontSizeValueInScope(cssProperties: ProcessedCSSLines): number | undefined;
91
91
  /**
92
92
  * Attempts to remove all non-essential words & characters from a style block.
@@ -117,6 +117,6 @@ export declare function findTokenNameByPropertyValue(propertyName: string, value
117
117
  * @param propertyName string camelCased css property.
118
118
  * @param value The computed value e.g '8px' -> '8'.
119
119
  */
120
- export declare function getTokenReplacement(propertyName: string, value: string): import("eslint-codemod-utils").StringableASTNode<import("estree").SimpleCallExpression> | undefined;
120
+ export declare function getTokenReplacement(propertyName: string, value: string): StringableASTNode<SimpleCallExpression> | undefined;
121
121
  export declare function getPropertyNodeFromParent(property: string, parentNode: ObjectExpression & Rule.NodeParentExtension): Property | SpreadElement | undefined;
122
122
  export declare function getValueForPropertyNode(propertyNode: Property | SpreadElement, context: Rule.RuleContext): string | number | null | undefined;
@@ -1,7 +1,7 @@
1
1
  import type { Rule } from 'eslint';
2
2
  import { type JSXAttribute, type JSXElement } from 'eslint-codemod-utils';
3
- export declare const BOX_IMPORT_MODULE = "@atlaskit/primitives/compiled";
4
- export declare const BOX_IMPORT_MODULE_NON_COMPILED = "@atlaskit/primitives";
3
+ export declare const FLEX_IMPORT_MODULE = "@atlaskit/primitives/compiled";
4
+ export declare const FLEX_IMPORT_MODULE_NON_COMPILED = "@atlaskit/primitives";
5
5
  export declare const TOKEN_IMPORT_MODULE = "@atlaskit/tokens";
6
6
  export declare const CSS_IMPORT_MODULE = "@atlaskit/css";
7
7
  export declare const CSSMAP_VARIABLE_NAME = "iconSpacingStyles";
@@ -32,12 +32,12 @@ export declare function getIconSize(node: JSXElement): string | undefined;
32
32
  */
33
33
  export declare function hasSpreadProps(node: JSXElement): boolean;
34
34
  /**
35
- * Upserts `Box` from `@atlaskit/primitives/compiled`, handling:
36
- * 1. Already imported from `/compiled` → add Box if missing
37
- * 2. Import from `@atlaskit/primitives` (non-compiled) → migrate path + add Box
38
- * 3. No import → insert new `import { Box } from '@atlaskit/primitives/compiled'`
35
+ * Upserts `Flex` from `@atlaskit/primitives/compiled`, handling:
36
+ * 1. Already imported from `/compiled` → add Flex if missing
37
+ * 2. Import from `@atlaskit/primitives` (non-compiled) → migrate path + add Flex
38
+ * 3. No import → insert new `import { Flex } from '@atlaskit/primitives/compiled'`
39
39
  */
40
- export declare function upsertBoxImport(context: Rule.RuleContext, fixer: Rule.RuleFixer): Rule.Fix | undefined;
40
+ export declare function upsertFlexImport(context: Rule.RuleContext, fixer: Rule.RuleFixer): Rule.Fix | undefined;
41
41
  /**
42
42
  * Upserts `cssMap` from `@atlaskit/css`, handling:
43
43
  * 1. Already imported → no-op
@@ -1,6 +1,6 @@
1
1
  import type { Rule } from 'eslint';
2
2
  export declare const RULE_NAME = "use-should-render-to-parent";
3
- export declare const addProp = "Add `shouldRenderToParent` prop.";
4
- export declare const setPropToTrue = "Set `shouldRenderToParent` prop to `true`.";
3
+ export declare const addProp: 'Add `shouldRenderToParent` prop.';
4
+ export declare const setPropToTrue: 'Set `shouldRenderToParent` prop to `true`.';
5
5
  declare const rule: Rule.RuleModule;
6
6
  export default rule;
@@ -1,3 +1,3 @@
1
1
  export declare const IMPORT_NAME = "AKVisuallyHidden";
2
2
  export declare const VISUALLY_HIDDEN_SOURCE = "@atlaskit/visually-hidden";
3
- export declare const VISUALLY_HIDDEN_IMPORT = "import AKVisuallyHidden from '@atlaskit/visually-hidden';\n";
3
+ export declare const VISUALLY_HIDDEN_IMPORT: "import AKVisuallyHidden from '@atlaskit/visually-hidden';\n";
@@ -1,44 +1,44 @@
1
1
  import { type Domains } from './types';
2
2
  declare const ruleMeta: {
3
- readonly name: "ensure-design-token-usage";
3
+ readonly name: 'ensure-design-token-usage';
4
4
  readonly hasSuggestions: true;
5
5
  readonly schema: {
6
- readonly type: "array";
6
+ readonly type: 'array';
7
7
  readonly items: {
8
- readonly type: "object";
8
+ readonly type: 'object';
9
9
  readonly properties: {
10
10
  readonly applyImport: {
11
- readonly type: "boolean";
11
+ readonly type: 'boolean';
12
12
  };
13
13
  readonly shouldEnforceFallbacks: {
14
- readonly type: "boolean";
14
+ readonly type: 'boolean';
15
15
  };
16
16
  readonly domains: {
17
- readonly type: "array";
17
+ readonly type: 'array';
18
18
  readonly items: {
19
19
  readonly enum: Domains;
20
20
  };
21
21
  };
22
22
  readonly exceptions: {
23
- readonly type: "array";
23
+ readonly type: 'array';
24
24
  };
25
25
  };
26
26
  };
27
27
  };
28
- readonly type: "problem";
29
- readonly fixable: "code";
28
+ readonly type: 'problem';
29
+ readonly fixable: 'code';
30
30
  readonly docs: {
31
- readonly description: "Enforces usage of design tokens rather than hard-coded values.";
31
+ readonly description: 'Enforces usage of design tokens rather than hard-coded values.';
32
32
  readonly recommended: true;
33
- readonly severity: "error";
33
+ readonly severity: 'error';
34
34
  };
35
35
  readonly messages: {
36
- readonly noRawRadiusValues: "The use of shape tokens is preferred over the direct application of border properties.\n\n@meta <<{{payload}}>>";
37
- readonly noRawSpacingValues: "The use of spacing primitives or tokens is preferred over the direct application of spacing properties.\n\n@meta <<{{payload}}>>";
38
- readonly autofixesPossible: "Automated corrections available for spacing values. Apply autofix to replace values with appropriate tokens";
39
- readonly noCalcUsage: "The use of space tokens is preferred over using the CSS calc function. If using a value that is not aligned to the spacing scale, consider aligning to the scale and using tokens instead.";
40
- readonly hardCodedColor: "Colors can be sourced from the global theme using the token function.";
41
- readonly legacyElevation: "Elevations can be sourced from the global theme using the token function made of both a background and shadow. Use \"card\" for card elevations, and \"overlay\" for anything else that should appear elevated.";
36
+ readonly noRawRadiusValues: 'The use of shape tokens is preferred over the direct application of border properties.\n\n@meta <<{{payload}}>>';
37
+ readonly noRawSpacingValues: 'The use of spacing primitives or tokens is preferred over the direct application of spacing properties.\n\n@meta <<{{payload}}>>';
38
+ readonly autofixesPossible: 'Automated corrections available for spacing values. Apply autofix to replace values with appropriate tokens';
39
+ readonly noCalcUsage: 'The use of space tokens is preferred over using the CSS calc function. If using a value that is not aligned to the spacing scale, consider aligning to the scale and using tokens instead.';
40
+ readonly hardCodedColor: 'Colors can be sourced from the global theme using the token function.';
41
+ readonly legacyElevation: 'Elevations can be sourced from the global theme using the token function made of both a background and shadow. Use "card" for card elevations, and "overlay" for anything else that should appear elevated.';
42
42
  };
43
43
  };
44
44
  export default ruleMeta;
@@ -1,5 +1,5 @@
1
1
  import type { Rule } from 'eslint';
2
- import { type EslintNode, type ObjectExpression, type Property, type SpreadElement, type TaggedTemplateExpression } from 'eslint-codemod-utils';
2
+ import { type EslintNode, type ObjectExpression, type Property, SimpleCallExpression, type SpreadElement, StringableASTNode, type TaggedTemplateExpression } from 'eslint-codemod-utils';
3
3
  import { type Domains } from './types';
4
4
  export type ProcessedCSSLines = [
5
5
  string,
@@ -89,7 +89,7 @@ export declare function processCssNode(node: TaggedTemplateExpression & Rule.Nod
89
89
  * propertyName: fontWeight, value: 400 => token('font.weight.regular', '400')
90
90
  * ```
91
91
  */
92
- export declare function getTokenNodeForValue(propertyName: string, value: string): import("eslint-codemod-utils").StringableASTNode<import("estree").SimpleCallExpression>;
92
+ export declare function getTokenNodeForValue(propertyName: string, value: string): StringableASTNode<SimpleCallExpression>;
93
93
  export declare function getFontSizeValueInScope(cssProperties: ProcessedCSSLines): number | undefined;
94
94
  /**
95
95
  * Attempts to remove all non-essential words & characters from a style block.
@@ -120,6 +120,6 @@ export declare function findTokenNameByPropertyValue(propertyName: string, value
120
120
  * @param propertyName string camelCased css property.
121
121
  * @param value The computed value e.g '8px' -> '8'.
122
122
  */
123
- export declare function getTokenReplacement(propertyName: string, value: string): import("eslint-codemod-utils").StringableASTNode<import("estree").SimpleCallExpression> | undefined;
123
+ export declare function getTokenReplacement(propertyName: string, value: string): StringableASTNode<SimpleCallExpression> | undefined;
124
124
  export declare function getPropertyNodeFromParent(property: string, parentNode: ObjectExpression & Rule.NodeParentExtension): Property | SpreadElement | undefined;
125
125
  export declare function getValueForPropertyNode(propertyNode: Property | SpreadElement, context: Rule.RuleContext): string | number | null | undefined;
@@ -1,7 +1,7 @@
1
1
  import type { Rule } from 'eslint';
2
2
  import { type JSXAttribute, type JSXElement } from 'eslint-codemod-utils';
3
- export declare const BOX_IMPORT_MODULE = "@atlaskit/primitives/compiled";
4
- export declare const BOX_IMPORT_MODULE_NON_COMPILED = "@atlaskit/primitives";
3
+ export declare const FLEX_IMPORT_MODULE = "@atlaskit/primitives/compiled";
4
+ export declare const FLEX_IMPORT_MODULE_NON_COMPILED = "@atlaskit/primitives";
5
5
  export declare const TOKEN_IMPORT_MODULE = "@atlaskit/tokens";
6
6
  export declare const CSS_IMPORT_MODULE = "@atlaskit/css";
7
7
  export declare const CSSMAP_VARIABLE_NAME = "iconSpacingStyles";
@@ -32,12 +32,12 @@ export declare function getIconSize(node: JSXElement): string | undefined;
32
32
  */
33
33
  export declare function hasSpreadProps(node: JSXElement): boolean;
34
34
  /**
35
- * Upserts `Box` from `@atlaskit/primitives/compiled`, handling:
36
- * 1. Already imported from `/compiled` → add Box if missing
37
- * 2. Import from `@atlaskit/primitives` (non-compiled) → migrate path + add Box
38
- * 3. No import → insert new `import { Box } from '@atlaskit/primitives/compiled'`
35
+ * Upserts `Flex` from `@atlaskit/primitives/compiled`, handling:
36
+ * 1. Already imported from `/compiled` → add Flex if missing
37
+ * 2. Import from `@atlaskit/primitives` (non-compiled) → migrate path + add Flex
38
+ * 3. No import → insert new `import { Flex } from '@atlaskit/primitives/compiled'`
39
39
  */
40
- export declare function upsertBoxImport(context: Rule.RuleContext, fixer: Rule.RuleFixer): Rule.Fix | undefined;
40
+ export declare function upsertFlexImport(context: Rule.RuleContext, fixer: Rule.RuleFixer): Rule.Fix | undefined;
41
41
  /**
42
42
  * Upserts `cssMap` from `@atlaskit/css`, handling:
43
43
  * 1. Already imported → no-op
@@ -1,6 +1,6 @@
1
1
  import type { Rule } from 'eslint';
2
2
  export declare const RULE_NAME = "use-should-render-to-parent";
3
- export declare const addProp = "Add `shouldRenderToParent` prop.";
4
- export declare const setPropToTrue = "Set `shouldRenderToParent` prop to `true`.";
3
+ export declare const addProp: 'Add `shouldRenderToParent` prop.';
4
+ export declare const setPropToTrue: 'Set `shouldRenderToParent` prop to `true`.';
5
5
  declare const rule: Rule.RuleModule;
6
6
  export default rule;
@@ -1,3 +1,3 @@
1
1
  export declare const IMPORT_NAME = "AKVisuallyHidden";
2
2
  export declare const VISUALLY_HIDDEN_SOURCE = "@atlaskit/visually-hidden";
3
- export declare const VISUALLY_HIDDEN_IMPORT = "import AKVisuallyHidden from '@atlaskit/visually-hidden';\n";
3
+ export declare const VISUALLY_HIDDEN_IMPORT: "import AKVisuallyHidden from '@atlaskit/visually-hidden';\n";
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": "13.41.1",
4
+ "version": "13.41.2",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "@af/formatting": "workspace:^",
58
- "@atlaskit/ds-lib": "^5.4.0",
58
+ "@atlaskit/ds-lib": "^6.0.0",
59
59
  "@atlaskit/theme": "^22.0.0",
60
60
  "@atlassian/codegen": "^0.1.0",
61
61
  "@atlassian/eslint-utils": "^0.5.0",