@atlaskit/eslint-plugin-design-system 13.0.2 → 13.0.4

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,19 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 13.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#128626](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128626)
8
+ [`142648610a166`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/142648610a166) -
9
+ Fixes the `consistent-css-prop-usage` rule to allow `xcss` pass-through values to the `xcss` prop.
10
+
11
+ ## 13.0.3
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 13.0.2
4
18
 
5
19
  ### Patch Changes
@@ -124,6 +124,21 @@ var JSXExpressionLinter = /*#__PURE__*/function () {
124
124
  // Identifier isn't in the module, skip!
125
125
  return;
126
126
  }
127
+
128
+ // Specifically for the `xcss` prop we allow `xcss` values that come from a function parameter.
129
+ if (this.cssAttributeName === 'xcss' && (
130
+ // Allowing `xcss` and `${string}Xcss` values
131
+ identifier.name === 'xcss' || identifier.name.endsWith('Xcss'))) {
132
+ var sourceCode = (0, _contextCompat.getSourceCode)(this.context);
133
+ var variable = (0, _findVariable.findVariable)({
134
+ identifier: identifier,
135
+ sourceCode: sourceCode
136
+ });
137
+ // Only allowing values where the parameter definition is the only definition
138
+ if ((variable === null || variable === void 0 ? void 0 : variable.defs.length) === 1 && (variable === null || variable === void 0 ? void 0 : variable.defs[0].type) === 'Parameter') {
139
+ return;
140
+ }
141
+ }
127
142
  if (identifier.parent.type !== 'VariableDeclarator') {
128
143
  // When variable is not in the file or coming from import
129
144
  this.context.report({
@@ -98,6 +98,21 @@ class JSXExpressionLinter {
98
98
  // Identifier isn't in the module, skip!
99
99
  return;
100
100
  }
101
+
102
+ // Specifically for the `xcss` prop we allow `xcss` values that come from a function parameter.
103
+ if (this.cssAttributeName === 'xcss' && (
104
+ // Allowing `xcss` and `${string}Xcss` values
105
+ identifier.name === 'xcss' || identifier.name.endsWith('Xcss'))) {
106
+ const sourceCode = getSourceCode(this.context);
107
+ const variable = findVariable({
108
+ identifier,
109
+ sourceCode
110
+ });
111
+ // Only allowing values where the parameter definition is the only definition
112
+ if ((variable === null || variable === void 0 ? void 0 : variable.defs.length) === 1 && (variable === null || variable === void 0 ? void 0 : variable.defs[0].type) === 'Parameter') {
113
+ return;
114
+ }
115
+ }
101
116
  if (identifier.parent.type !== 'VariableDeclarator') {
102
117
  // When variable is not in the file or coming from import
103
118
  this.context.report({
@@ -117,6 +117,21 @@ var JSXExpressionLinter = /*#__PURE__*/function () {
117
117
  // Identifier isn't in the module, skip!
118
118
  return;
119
119
  }
120
+
121
+ // Specifically for the `xcss` prop we allow `xcss` values that come from a function parameter.
122
+ if (this.cssAttributeName === 'xcss' && (
123
+ // Allowing `xcss` and `${string}Xcss` values
124
+ identifier.name === 'xcss' || identifier.name.endsWith('Xcss'))) {
125
+ var sourceCode = getSourceCode(this.context);
126
+ var variable = findVariable({
127
+ identifier: identifier,
128
+ sourceCode: sourceCode
129
+ });
130
+ // Only allowing values where the parameter definition is the only definition
131
+ if ((variable === null || variable === void 0 ? void 0 : variable.defs.length) === 1 && (variable === null || variable === void 0 ? void 0 : variable.defs[0].type) === 'Parameter') {
132
+ return;
133
+ }
134
+ }
120
135
  if (identifier.parent.type !== 'VariableDeclarator') {
121
136
  // When variable is not in the file or coming from import
122
137
  this.context.report({
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.0.2",
4
+ "version": "13.0.4",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {
@@ -44,9 +44,9 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@atlaskit/eslint-utils": "^2.0.0",
47
- "@atlaskit/icon": "^24.1.0",
48
- "@atlaskit/icon-lab": "^3.4.0",
49
- "@atlaskit/tokens": "^4.3.0",
47
+ "@atlaskit/icon": "^25.0.0",
48
+ "@atlaskit/icon-lab": "^4.1.0",
49
+ "@atlaskit/tokens": "^4.5.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "@typescript-eslint/utils": "^7.1.0",
52
52
  "ajv": "^6.12.6",