@atlaskit/eslint-plugin-design-system 10.17.1 → 10.17.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,14 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 10.17.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#133689](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/133689)
8
+ [`5b1de3a5df2be`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5b1de3a5df2be) -
9
+ Fix bug in no-legacy-icons where in certain tooling, the token() function wasn't recognised
10
+ correctly when resolving icon colors.
11
+
3
12
  ## 10.17.1
4
13
 
5
14
  ### Patch Changes
@@ -9,7 +9,6 @@ exports.locToString = exports.isSize = exports.isInsideNewButton = exports.isIns
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _eslintCodemodUtils = require("eslint-codemod-utils");
11
11
  var _UNSAFE_migrationMap = _interopRequireWildcard(require("@atlaskit/icon/UNSAFE_migration-map"));
12
- var _getImportName = require("../utils/get-import-name");
13
12
  var _upcomingIcons = require("./upcoming-icons");
14
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -322,8 +321,12 @@ var createHelpers = exports.createHelpers = function createHelpers(context) {
322
321
  * @returns The value of the token call, or null if it could not be extracted
323
322
  */
324
323
  var getTokenCallValue = function getTokenCallValue(value) {
325
- var tokenName = (0, _getImportName.getImportName)(context.sourceCode.getScope(value), '@atlaskit/tokens', 'token');
326
- if (tokenName && (0, _eslintCodemodUtils.isNodeOfType)(value, 'JSXExpressionContainer') && (0, _eslintCodemodUtils.isNodeOfType)(value.expression, 'CallExpression') && 'name' in value.expression.callee && value.expression.callee.name === tokenName) {
324
+ /**
325
+ * Previously, we used getImportName() to extract the token name from a token() call.
326
+ * However, this was failing in the Issue Automat so we are now using a simpler approach.
327
+ */
328
+
329
+ if ((0, _eslintCodemodUtils.isNodeOfType)(value, 'JSXExpressionContainer') && (0, _eslintCodemodUtils.isNodeOfType)(value.expression, 'CallExpression') && 'name' in value.expression.callee && value.expression.callee.name === 'token') {
327
330
  // propName={token("color...."}
328
331
  return getLiteralStringValue(value.expression.arguments[0]);
329
332
  }
@@ -1,6 +1,5 @@
1
1
  import { isNodeOfType, literal } from 'eslint-codemod-utils';
2
2
  import baseMigrationMap, { migrationOutcomeDescriptionMap } from '@atlaskit/icon/UNSAFE_migration-map';
3
- import { getImportName } from '../utils/get-import-name';
4
3
  import { upcomingIcons } from './upcoming-icons';
5
4
  const sizes = ['small', 'medium', 'large', 'xlarge'];
6
5
  export const isSize = size => sizes.includes(size);
@@ -308,8 +307,12 @@ export const createHelpers = context => {
308
307
  * @returns The value of the token call, or null if it could not be extracted
309
308
  */
310
309
  const getTokenCallValue = value => {
311
- const tokenName = getImportName(context.sourceCode.getScope(value), '@atlaskit/tokens', 'token');
312
- if (tokenName && isNodeOfType(value, 'JSXExpressionContainer') && isNodeOfType(value.expression, 'CallExpression') && 'name' in value.expression.callee && value.expression.callee.name === tokenName) {
310
+ /**
311
+ * Previously, we used getImportName() to extract the token name from a token() call.
312
+ * However, this was failing in the Issue Automat so we are now using a simpler approach.
313
+ */
314
+
315
+ if (isNodeOfType(value, 'JSXExpressionContainer') && isNodeOfType(value.expression, 'CallExpression') && 'name' in value.expression.callee && value.expression.callee.name === 'token') {
313
316
  // propName={token("color...."}
314
317
  return getLiteralStringValue(value.expression.arguments[0]);
315
318
  }
@@ -1,7 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { isNodeOfType, literal } from 'eslint-codemod-utils';
3
3
  import baseMigrationMap, { migrationOutcomeDescriptionMap } from '@atlaskit/icon/UNSAFE_migration-map';
4
- import { getImportName } from '../utils/get-import-name';
5
4
  import { upcomingIcons } from './upcoming-icons';
6
5
  var sizes = ['small', 'medium', 'large', 'xlarge'];
7
6
  export var isSize = function isSize(size) {
@@ -312,8 +311,12 @@ export var createHelpers = function createHelpers(context) {
312
311
  * @returns The value of the token call, or null if it could not be extracted
313
312
  */
314
313
  var getTokenCallValue = function getTokenCallValue(value) {
315
- var tokenName = getImportName(context.sourceCode.getScope(value), '@atlaskit/tokens', 'token');
316
- if (tokenName && isNodeOfType(value, 'JSXExpressionContainer') && isNodeOfType(value.expression, 'CallExpression') && 'name' in value.expression.callee && value.expression.callee.name === tokenName) {
314
+ /**
315
+ * Previously, we used getImportName() to extract the token name from a token() call.
316
+ * However, this was failing in the Issue Automat so we are now using a simpler approach.
317
+ */
318
+
319
+ if (isNodeOfType(value, 'JSXExpressionContainer') && isNodeOfType(value.expression, 'CallExpression') && 'name' in value.expression.callee && value.expression.callee.name === 'token') {
317
320
  // propName={token("color...."}
318
321
  return getLiteralStringValue(value.expression.arguments[0]);
319
322
  }
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.17.1",
4
+ "version": "10.17.2",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {