@atlaskit/eslint-plugin-design-system 8.36.2 → 8.36.3
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 +6 -0
- package/dist/cjs/rules/utils/create-no-tagged-template-expression-rule/generate.js +4 -1
- package/dist/cjs/rules/utils/create-no-tagged-template-expression-rule/to-arguments.js +15 -4
- package/dist/es2019/rules/utils/create-no-tagged-template-expression-rule/generate.js +6 -1
- package/dist/es2019/rules/utils/create-no-tagged-template-expression-rule/to-arguments.js +13 -2
- package/dist/esm/rules/utils/create-no-tagged-template-expression-rule/generate.js +4 -1
- package/dist/esm/rules/utils/create-no-tagged-template-expression-rule/to-arguments.js +15 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 8.36.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
3
9
|
## 8.36.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -28,7 +28,10 @@ var createKey = function createKey(key) {
|
|
|
28
28
|
return "[`".concat(key, "`]");
|
|
29
29
|
};
|
|
30
30
|
var addQuotes = function addQuotes(literal) {
|
|
31
|
-
|
|
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
|
-
|
|
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'
|
|
@@ -16,7 +16,12 @@ const createKey = key => {
|
|
|
16
16
|
}
|
|
17
17
|
return `[\`${key}\`]`;
|
|
18
18
|
};
|
|
19
|
-
const addQuotes = 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
|
-
|
|
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'
|
|
@@ -21,7 +21,10 @@ var createKey = function createKey(key) {
|
|
|
21
21
|
return "[`".concat(key, "`]");
|
|
22
22
|
};
|
|
23
23
|
var addQuotes = function addQuotes(literal) {
|
|
24
|
-
|
|
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
|
-
|
|
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.
|
|
4
|
+
"version": "8.36.3",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"registry": "https://registry.npmjs.org/"
|