@vue-jsx-vapor/eslint 2.5.2 → 2.5.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/dist/index.cjs CHANGED
@@ -52,13 +52,14 @@ const rule$1 = {
52
52
  if (callee.type === "Identifier" && callee.name === "defineStyle") {
53
53
  const arg = node.arguments[0];
54
54
  if (arg?.type === "TemplateLiteral") {
55
- const cssRaw = arg.quasis[0].value.raw;
55
+ let index = 0;
56
+ const cssRaw = context.sourceCode.text.slice(arg.range[0] + 1, arg.range[1] - 1);
56
57
  let formattedCss = "";
57
58
  try {
58
- formattedCss = __prettier_sync.default.format(cssRaw, {
59
+ formattedCss = __prettier_sync.default.format(arg.quasis.map((i) => i.value.raw + (arg.expressions[index] ? `-MACROS_START-${context.sourceCode.text.slice(...arg.expressions[index++].range)}-MACROS_END-` : "")).join(""), {
59
60
  parser,
60
61
  tabWidth
61
- });
62
+ }).replaceAll("-MACROS_START-", "${").replaceAll("-MACROS_END-", "}");
62
63
  } catch {
63
64
  return context.report({
64
65
  node: arg,
package/dist/index.js CHANGED
@@ -28,13 +28,14 @@ const rule$1 = {
28
28
  if (callee.type === "Identifier" && callee.name === "defineStyle") {
29
29
  const arg = node.arguments[0];
30
30
  if (arg?.type === "TemplateLiteral") {
31
- const cssRaw = arg.quasis[0].value.raw;
31
+ let index = 0;
32
+ const cssRaw = context.sourceCode.text.slice(arg.range[0] + 1, arg.range[1] - 1);
32
33
  let formattedCss = "";
33
34
  try {
34
- formattedCss = prettier.format(cssRaw, {
35
+ formattedCss = prettier.format(arg.quasis.map((i) => i.value.raw + (arg.expressions[index] ? `-MACROS_START-${context.sourceCode.text.slice(...arg.expressions[index++].range)}-MACROS_END-` : "")).join(""), {
35
36
  parser,
36
37
  tabWidth
37
- });
38
+ }).replaceAll("-MACROS_START-", "${").replaceAll("-MACROS_END-", "}");
38
39
  } catch {
39
40
  return context.report({
40
41
  node: arg,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-jsx-vapor/eslint",
3
- "version": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "description": "Vue JSX Vapor ESLint Plugin",
5
5
  "type": "module",
6
6
  "keywords": [