@salty-css/eslint-plugin-core 0.0.1-alpha.182 → 0.0.1-alpha.184

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.
Files changed (2) hide show
  1. package/index.js +15 -15
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -34,24 +34,24 @@ const P = ["salty", "css", "styles", "styled"], S = (r = []) => new RegExp(`\\.(
34
34
  if (!o) return;
35
35
  const { value: u } = o;
36
36
  if (!(u.type === "ObjectExpression")) return;
37
- const n = u.properties.find(
37
+ const a = u.properties.find(
38
38
  (s) => s.type === "Property" && s.key.type === "Identifier" && s.key.name === "variants"
39
39
  );
40
- if (!n) return;
40
+ if (!a) return;
41
41
  r.report({
42
- node: n,
42
+ node: a,
43
43
  messageId: "nestedVariants",
44
44
  fix: (s) => {
45
- if (!n.range) return null;
46
- const { sourceCode: m } = r, b = m.getText(n), E = e.properties.indexOf(o), p = e.properties[E];
45
+ if (!a.range) return null;
46
+ const { sourceCode: m } = r, b = m.getText(a), E = e.properties.indexOf(o), p = e.properties[E];
47
47
  if (!p.range) return null;
48
48
  const v = [p.range[1], p.range[1]], y = [
49
- n.range[0] - 1,
49
+ a.range[0] - 1,
50
50
  // Include the preceding comma (if any)
51
- n.range[1]
51
+ a.range[1]
52
52
  ];
53
- if (u.properties.at(-1) === n) {
54
- const g = m.text.slice(n.range[1]).match(/^\s*,/);
53
+ if (u.properties.at(-1) === a) {
54
+ const g = m.text.slice(a.range[1]).match(/^\s*,/);
55
55
  g && (y[1] += g[0].length);
56
56
  }
57
57
  return [s.removeRange(y), s.insertTextAfterRange(v, `, ${b}`)];
@@ -81,9 +81,9 @@ const P = ["salty", "css", "styles", "styled"], S = (r = []) => new RegExp(`\\.(
81
81
  if (!x(r.filename)) return {};
82
82
  function c(t) {
83
83
  if (t.type === "VariableDeclaration") {
84
- const a = t.declarations[0];
85
- if (a.type !== "VariableDeclarator") return;
86
- const e = a.init;
84
+ const n = t.declarations[0];
85
+ if (n.type !== "VariableDeclarator") return;
86
+ const e = n.init;
87
87
  if ((e == null ? void 0 : e.type) !== "CallExpression") return;
88
88
  const d = ["styled", "keyframes"];
89
89
  if (e.callee.type === "Identifier" && d.includes(e.callee.name))
@@ -95,15 +95,15 @@ const P = ["salty", "css", "styles", "styled"], S = (r = []) => new RegExp(`\\.(
95
95
  return !1;
96
96
  }
97
97
  function i(t) {
98
- const a = t.parent;
99
- return a.type === "ExportNamedDeclaration" || a.type === "ExportDefaultDeclaration";
98
+ const n = t.parent;
99
+ return n.type === "ExportNamedDeclaration" || n.type === "ExportDefaultDeclaration";
100
100
  }
101
101
  return {
102
102
  VariableDeclaration: (t) => {
103
103
  c(t) && (i(t) || r.report({
104
104
  node: t,
105
105
  messageId: "mustBeExported",
106
- fix: (a) => a.insertTextBefore(t, "export ")
106
+ fix: (n) => n.insertTextBefore(t, "export ")
107
107
  }));
108
108
  }
109
109
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/eslint-plugin-core",
3
- "version": "0.0.1-alpha.182",
3
+ "version": "0.0.1-alpha.184",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
- "@salty-css/core": "^0.0.1-alpha.182",
37
+ "@salty-css/core": "^0.0.1-alpha.184",
38
38
  "eslint": ">=9.x || >=8.x || >=7.x"
39
39
  }
40
40
  }