@atlaskit/eslint-plugin-design-system 8.36.2 → 8.37.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,17 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 8.37.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#81166](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81166) [`a249a1bd29a6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a249a1bd29a6) - Upgrade ESLint to version 8
8
+
9
+ ## 8.36.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#77172](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77172) [`0e9162a7371a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0e9162a7371a) - Fixes issues with CSS var and content string handling for the `no-*-tagged-template-expression` rules
14
+
3
15
  ## 8.36.2
4
16
 
5
17
  ### Patch Changes
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -28,7 +28,10 @@ var createKey = function createKey(key) {
28
28
  return "[`".concat(key, "`]");
29
29
  };
30
30
  var addQuotes = function addQuotes(literal) {
31
- return literal[0] === "\"" ? "'".concat(literal, "'") : "\"".concat(literal, "\"");
31
+ if (literal[0] === "\"") {
32
+ return "'".concat(literal.replace(/'/g, "\\'"), "'");
33
+ }
34
+ return "\"".concat(literal.replace(/"/g, "\\\""), "\"");
32
35
  };
33
36
  var createValue = function createValue(value) {
34
37
  var type = value.type;
@@ -119,14 +119,25 @@ var getArguments = function getArguments(chars) {
119
119
  };
120
120
  args.push({
121
121
  type: 'declaration',
122
- // Make the property camelCase
123
- property: property.trim().replace(/-[a-z]/g, function (match) {
124
- return match[1].toUpperCase();
125
- }),
122
+ property: getPropertyForDeclaration(property),
126
123
  value: getValue()
127
124
  });
128
125
  return args;
129
126
  };
127
+
128
+ /**
129
+ * Trims the property value. Converts it to camelCase if it isn't a variable.
130
+ */
131
+ var getPropertyForDeclaration = function getPropertyForDeclaration(property) {
132
+ var trimmed = property.trim();
133
+ if (trimmed.startsWith('--')) {
134
+ return trimmed;
135
+ }
136
+ // Make the property camelCase if it isn't a CSS variable
137
+ return trimmed.replace(/-[a-z]/g, function (match) {
138
+ return match[1].toUpperCase();
139
+ });
140
+ };
130
141
  var getSelectorValue = function getSelectorValue(chars, expressions) {
131
142
  // If no variable, returns chars immediately.
132
143
  // i.e. `.foo { color: red }` returns '.foo'
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -1 +0,0 @@
1
- export {};
@@ -16,7 +16,12 @@ const createKey = key => {
16
16
  }
17
17
  return `[\`${key}\`]`;
18
18
  };
19
- const addQuotes = literal => literal[0] === `"` ? `'${literal}'` : `"${literal}"`;
19
+ const addQuotes = literal => {
20
+ if (literal[0] === `"`) {
21
+ return `'${literal.replace(/'/g, `\\'`)}'`;
22
+ }
23
+ return `"${literal.replace(/"/g, `\\"`)}"`;
24
+ };
20
25
  const createValue = value => {
21
26
  const {
22
27
  type
@@ -92,12 +92,23 @@ const getArguments = (chars, expressions = []) => {
92
92
  };
93
93
  args.push({
94
94
  type: 'declaration',
95
- // Make the property camelCase
96
- property: property.trim().replace(/-[a-z]/g, match => match[1].toUpperCase()),
95
+ property: getPropertyForDeclaration(property),
97
96
  value: getValue()
98
97
  });
99
98
  return args;
100
99
  };
100
+
101
+ /**
102
+ * Trims the property value. Converts it to camelCase if it isn't a variable.
103
+ */
104
+ const getPropertyForDeclaration = property => {
105
+ const trimmed = property.trim();
106
+ if (trimmed.startsWith('--')) {
107
+ return trimmed;
108
+ }
109
+ // Make the property camelCase if it isn't a CSS variable
110
+ return trimmed.replace(/-[a-z]/g, match => match[1].toUpperCase());
111
+ };
101
112
  const getSelectorValue = (chars, expressions) => {
102
113
  // If no variable, returns chars immediately.
103
114
  // i.e. `.foo { color: red }` returns '.foo'
@@ -1 +0,0 @@
1
- export {};
@@ -21,7 +21,10 @@ var createKey = function createKey(key) {
21
21
  return "[`".concat(key, "`]");
22
22
  };
23
23
  var addQuotes = function addQuotes(literal) {
24
- return literal[0] === "\"" ? "'".concat(literal, "'") : "\"".concat(literal, "\"");
24
+ if (literal[0] === "\"") {
25
+ return "'".concat(literal.replace(/'/g, "\\'"), "'");
26
+ }
27
+ return "\"".concat(literal.replace(/"/g, "\\\""), "\"");
25
28
  };
26
29
  var createValue = function createValue(value) {
27
30
  var type = value.type;
@@ -112,14 +112,25 @@ var getArguments = function getArguments(chars) {
112
112
  };
113
113
  args.push({
114
114
  type: 'declaration',
115
- // Make the property camelCase
116
- property: property.trim().replace(/-[a-z]/g, function (match) {
117
- return match[1].toUpperCase();
118
- }),
115
+ property: getPropertyForDeclaration(property),
119
116
  value: getValue()
120
117
  });
121
118
  return args;
122
119
  };
120
+
121
+ /**
122
+ * Trims the property value. Converts it to camelCase if it isn't a variable.
123
+ */
124
+ var getPropertyForDeclaration = function getPropertyForDeclaration(property) {
125
+ var trimmed = property.trim();
126
+ if (trimmed.startsWith('--')) {
127
+ return trimmed;
128
+ }
129
+ // Make the property camelCase if it isn't a CSS variable
130
+ return trimmed.replace(/-[a-z]/g, function (match) {
131
+ return match[1].toUpperCase();
132
+ });
133
+ };
123
134
  var getSelectorValue = function getSelectorValue(chars, expressions) {
124
135
  // If no variable, returns chars immediately.
125
136
  // i.e. `.foo { color: red }` returns '.foo'
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": "8.36.2",
4
+ "version": "8.37.0",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
7
7
  "registry": "https://registry.npmjs.org/"
@@ -50,12 +50,12 @@
50
50
  "@atlaskit/theme": "^12.6.0",
51
51
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
52
52
  "@atlassian/codegen": "*",
53
- "@atlassian/eslint-utils": "^0.3.0",
53
+ "@atlassian/eslint-utils": "^0.4.0",
54
54
  "@emotion/react": "^11.7.1",
55
55
  "@emotion/styled": "^11.0.0",
56
56
  "@types/eslint": "^8.4.5",
57
57
  "@types/estraverse": "^5.1.7",
58
- "eslint": "^7.7.0",
58
+ "eslint": "^8.49.0",
59
59
  "jscodeshift": "^0.13.0",
60
60
  "outdent": "^0.5.0",
61
61
  "prettier": "^2.8.0",