@atlaskit/eslint-plugin-design-system 4.13.10 → 4.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 4.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`be1ec01a101`](https://bitbucket.org/atlassian/atlassian-frontend/commits/be1ec01a101) - Added another valid callee `getTokenValue()` which is used for getting the current computed CSS value for the resulting CSS Custom Property, hard-coded colors that wrapped in `getTokenValue()` call won't fail.
8
+
3
9
  ## 4.13.10
4
10
 
5
11
  ### Patch Changes
@@ -94,7 +94,7 @@ var rule = {
94
94
  return;
95
95
  }
96
96
  },
97
- 'CallExpression[callee.name="token"]': function CallExpressionCalleeNameToken(node) {
97
+ 'CallExpression:matches([callee.name="token"], [callee.name="getTokenValue"])': function CallExpressionMatchesCalleeNameTokenCalleeNameGetTokenValue(node) {
98
98
  if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'CallExpression')) {
99
99
  return;
100
100
  }
@@ -111,7 +111,7 @@ var rule = {
111
111
  messageId: 'tokenFallbackRestricted',
112
112
  node: node.arguments[1],
113
113
  fix: function fix(fixer) {
114
- return fixer.replaceText(node, "token('".concat(value, "')"));
114
+ return fixer.replaceText(node, "".concat((0, _eslintCodemodUtils.isNodeOfType)(node.callee, 'Identifier') ? node.callee.name : 'token', "('").concat(value, "')"));
115
115
  }
116
116
  });
117
117
  } else {
@@ -8,7 +8,7 @@ exports.isVariableName = exports.isStyledTemplateNode = exports.isStyledObjectNo
8
8
  var _eslintCodemodUtils = require("eslint-codemod-utils");
9
9
 
10
10
  var isDecendantOfGlobalToken = function isDecendantOfGlobalToken(node) {
11
- if ((0, _eslintCodemodUtils.isNodeOfType)(node, 'CallExpression') && (0, _eslintCodemodUtils.isNodeOfType)(node.callee, 'Identifier') && node.callee.name === 'token') {
11
+ if ((0, _eslintCodemodUtils.isNodeOfType)(node, 'CallExpression') && (0, _eslintCodemodUtils.isNodeOfType)(node.callee, 'Identifier') && (node.callee.name === 'token' || node.callee.name === 'getTokenValue')) {
12
12
  return true;
13
13
  }
14
14
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-design-system",
3
- "version": "4.13.10",
3
+ "version": "4.14.0",
4
4
  "sideEffects": false
5
5
  }
@@ -98,7 +98,7 @@ token('color.background.blanket');
98
98
  return;
99
99
  }
100
100
  },
101
- 'CallExpression[callee.name="token"]': node => {
101
+ 'CallExpression:matches([callee.name="token"], [callee.name="getTokenValue"])': node => {
102
102
  if (!isNodeOfType(node, 'CallExpression')) {
103
103
  return;
104
104
  }
@@ -116,7 +116,7 @@ token('color.background.blanket');
116
116
  context.report({
117
117
  messageId: 'tokenFallbackRestricted',
118
118
  node: node.arguments[1],
119
- fix: fixer => fixer.replaceText(node, `token('${value}')`)
119
+ fix: fixer => fixer.replaceText(node, `${isNodeOfType(node.callee, 'Identifier') ? node.callee.name : 'token'}('${value}')`)
120
120
  });
121
121
  } else {
122
122
  context.report({
@@ -1,6 +1,6 @@
1
1
  import { isNodeOfType } from 'eslint-codemod-utils';
2
2
  export const isDecendantOfGlobalToken = node => {
3
- if (isNodeOfType(node, 'CallExpression') && isNodeOfType(node.callee, 'Identifier') && node.callee.name === 'token') {
3
+ if (isNodeOfType(node, 'CallExpression') && isNodeOfType(node.callee, 'Identifier') && (node.callee.name === 'token' || node.callee.name === 'getTokenValue')) {
4
4
  return true;
5
5
  }
6
6
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-design-system",
3
- "version": "4.13.10",
3
+ "version": "4.14.0",
4
4
  "sideEffects": false
5
5
  }
@@ -79,7 +79,7 @@ var rule = {
79
79
  return;
80
80
  }
81
81
  },
82
- 'CallExpression[callee.name="token"]': function CallExpressionCalleeNameToken(node) {
82
+ 'CallExpression:matches([callee.name="token"], [callee.name="getTokenValue"])': function CallExpressionMatchesCalleeNameTokenCalleeNameGetTokenValue(node) {
83
83
  if (!isNodeOfType(node, 'CallExpression')) {
84
84
  return;
85
85
  }
@@ -96,7 +96,7 @@ var rule = {
96
96
  messageId: 'tokenFallbackRestricted',
97
97
  node: node.arguments[1],
98
98
  fix: function fix(fixer) {
99
- return fixer.replaceText(node, "token('".concat(value, "')"));
99
+ return fixer.replaceText(node, "".concat(isNodeOfType(node.callee, 'Identifier') ? node.callee.name : 'token', "('").concat(value, "')"));
100
100
  }
101
101
  });
102
102
  } else {
@@ -1,6 +1,6 @@
1
1
  import { isNodeOfType } from 'eslint-codemod-utils';
2
2
  export var isDecendantOfGlobalToken = function isDecendantOfGlobalToken(node) {
3
- if (isNodeOfType(node, 'CallExpression') && isNodeOfType(node.callee, 'Identifier') && node.callee.name === 'token') {
3
+ if (isNodeOfType(node, 'CallExpression') && isNodeOfType(node.callee, 'Identifier') && (node.callee.name === 'token' || node.callee.name === 'getTokenValue')) {
4
4
  return true;
5
5
  }
6
6
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-design-system",
3
- "version": "4.13.10",
3
+ "version": "4.14.0",
4
4
  "sideEffects": false
5
5
  }
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": "4.13.10",
4
+ "version": "4.14.0",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
7
7
  "registry": "https://registry.npmjs.org/"
package/report.api.md CHANGED
@@ -1,4 +1,4 @@
1
- <!-- API Report Version: 2.2 -->
1
+ <!-- API Report Version: 2.3 -->
2
2
 
3
3
  ## API Report File for "@atlaskit/eslint-plugin-design-system"
4
4