@salty-css/eslint-plugin-core 0.2.1 → 0.2.2-refactor-vite-8.8

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/README.md CHANGED
@@ -79,29 +79,29 @@ Full reference → [salty-css.dev/docs/eslint](https://salty-css.dev/docs/eslint
79
79
 
80
80
  ## API index
81
81
 
82
- | Symbol | Import | One-liner | Docs |
83
- | ----------------------------------------------- | ------------------------------ | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
84
- | [`styled`](#styled) | `@salty-css/react/styled` | React component factory with variants & extension. | [api/styled](https://salty-css.dev/docs/api/styled) |
85
- | [`className`](#classname) | `@salty-css/react/class-name` | CSS class string with `.variant()` chaining. | [api/classname](https://salty-css.dev/docs/api/classname) |
86
- | [Variants](#variants) | — | `variants`, `compoundVariants`, `anyOfVariants`, `defaultVariants` semantics. | [variants](https://salty-css.dev/docs/variants) |
87
- | [Overrides](#overrides) | — | Extend components, swap element, override per-instance via `style`. | [overrides](https://salty-css.dev/docs/overrides) |
88
- | [ESLint plugin](#eslint) | `@salty-css/eslint-config-core` | Two rules: enforce `export` and correct `variants` placement on Salty files. | [eslint](https://salty-css.dev/docs/eslint) |
89
- | [`defineConfig`](#defineconfig) | `@salty-css/core/config` | Top-level project config. | [api/config](https://salty-css.dev/docs/api/config) |
90
- | [`defineVariables`](#definevariables) | `@salty-css/core/factories` | Static, responsive, and conditional CSS variables (tokens). | [variables](https://salty-css.dev/docs/variables) |
91
- | [Theming](#theming) | — | `data-theme` switcher built on conditional variables. | [theming](https://salty-css.dev/docs/theming) |
92
- | [`defineGlobalStyles`](#defineglobalstyles) | `@salty-css/core/factories` | Global rules (`html`, `body`, etc.). | [api/define-factories](https://salty-css.dev/docs/api/define-factories) |
93
- | [`defineMediaQuery`](#definemediaquery) | `@salty-css/core/factories` | Named, reusable media queries. | [media-queries](https://salty-css.dev/docs/media-queries) |
94
- | [`defineTemplates`](#definetemplates) | `@salty-css/core/factories` | Reusable style bundles, optionally with variants. | [templates](https://salty-css.dev/docs/templates) |
95
- | [`defineFont`](#definefont) | `@salty-css/core/factories` | `@font-face` (or `@import`) + CSS variable in one. | [fonts](https://salty-css.dev/docs/fonts) |
96
- | [`defineImport`](#defineimport) | `@salty-css/core/factories` | Pull external CSS into Salty's `imports` layer. | [imports](https://salty-css.dev/docs/imports) |
97
- | [`keyframes`](#keyframes) | `@salty-css/react/keyframes` | Typed `@keyframes` with params and initial-state injection. | [animations](https://salty-css.dev/docs/animations) |
98
- | [`defineViewportClamp`](#defineviewportclamp) | `@salty-css/core/helpers` | Fluid `clamp()` values that scale with the viewport. | [viewport-clamp](https://salty-css.dev/docs/viewport-clamp) |
99
- | [`color`](#color) | `@salty-css/core/helpers` | Color manipulation (`alpha`, `darken`, …). | [color-function](https://salty-css.dev/docs/color-function) |
100
- | [Modifiers](#modifiers) | (on `defineConfig`) | Custom value transformers, e.g. `'space:3'` → `'12px'`. | [modifiers](https://salty-css.dev/docs/modifiers) |
101
- | [`withSaltyCss`](#withsaltycss-nextjs) | `@salty-css/next` | Next.js config wrapper (Webpack + Turbopack). | [installation](https://salty-css.dev/docs/installation) |
102
- | [`saltyPlugin` (Vite)](#saltyplugin-vite) | `@salty-css/vite` | Vite plugin. | [installation](https://salty-css.dev/docs/installation) |
103
- | [`saltyPlugin` (Webpack)](#saltyplugin-webpack) | `@salty-css/webpack` | Webpack loader + plugin. | [installation](https://salty-css.dev/docs/installation) |
104
- | [`saltyIntegration`](#saltyintegration-astro) | `@salty-css/astro/integration` | Astro integration. | [installation](https://salty-css.dev/docs/installation) |
82
+ | Symbol | Import | One-liner | Docs |
83
+ | ----------------------------------------------- | ------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
84
+ | [`styled`](#styled) | `@salty-css/react/styled` | React component factory with variants & extension. | [api/styled](https://salty-css.dev/docs/api/styled) |
85
+ | [`className`](#classname) | `@salty-css/react/class-name` | CSS class string with `.variant()` chaining. | [api/classname](https://salty-css.dev/docs/api/classname) |
86
+ | [Variants](#variants) | — | `variants`, `compoundVariants`, `anyOfVariants`, `defaultVariants` semantics. | [variants](https://salty-css.dev/docs/variants) |
87
+ | [Overrides](#overrides) | — | Extend components, swap element, override per-instance via `style`. | [overrides](https://salty-css.dev/docs/overrides) |
88
+ | [ESLint plugin](#eslint) | `@salty-css/eslint-config-core` | Two rules: enforce `export` and correct `variants` placement on Salty files. | [eslint](https://salty-css.dev/docs/eslint) |
89
+ | [`defineConfig`](#defineconfig) | `@salty-css/core/config` | Top-level project config. | [api/config](https://salty-css.dev/docs/api/config) |
90
+ | [`defineVariables`](#definevariables) | `@salty-css/core/factories` | Static, responsive, and conditional CSS variables (tokens). | [variables](https://salty-css.dev/docs/variables) |
91
+ | [Theming](#theming) | — | `data-theme` switcher built on conditional variables. | [theming](https://salty-css.dev/docs/theming) |
92
+ | [`defineGlobalStyles`](#defineglobalstyles) | `@salty-css/core/factories` | Global rules (`html`, `body`, etc.). | [api/define-factories](https://salty-css.dev/docs/api/define-factories) |
93
+ | [`defineMediaQuery`](#definemediaquery) | `@salty-css/core/factories` | Named, reusable media queries. | [media-queries](https://salty-css.dev/docs/media-queries) |
94
+ | [`defineTemplates`](#definetemplates) | `@salty-css/core/factories` | Reusable style bundles, optionally with variants. | [templates](https://salty-css.dev/docs/templates) |
95
+ | [`defineFont`](#definefont) | `@salty-css/core/factories` | `@font-face` (or `@import`) + CSS variable in one. | [fonts](https://salty-css.dev/docs/fonts) |
96
+ | [`defineImport`](#defineimport) | `@salty-css/core/factories` | Pull external CSS into Salty's `imports` layer. | [imports](https://salty-css.dev/docs/imports) |
97
+ | [`keyframes`](#keyframes) | `@salty-css/react/keyframes` | Typed `@keyframes` with params and initial-state injection. | [animations](https://salty-css.dev/docs/animations) |
98
+ | [`defineViewportClamp`](#defineviewportclamp) | `@salty-css/core/helpers` | Fluid `clamp()` values that scale with the viewport. | [viewport-clamp](https://salty-css.dev/docs/viewport-clamp) |
99
+ | [`color`](#color) | `@salty-css/core/helpers` | Color manipulation (`alpha`, `darken`, …). | [color-function](https://salty-css.dev/docs/color-function) |
100
+ | [Modifiers](#modifiers) | (on `defineConfig`) | Custom value transformers, e.g. `'space:3'` → `'12px'`. | [modifiers](https://salty-css.dev/docs/modifiers) |
101
+ | [`withSaltyCss`](#withsaltycss-nextjs) | `@salty-css/next` | Next.js config wrapper (Webpack + Turbopack). | [installation](https://salty-css.dev/docs/installation) |
102
+ | [`saltyPlugin` (Vite)](#saltyplugin-vite) | `@salty-css/vite` | Vite plugin. | [installation](https://salty-css.dev/docs/installation) |
103
+ | [`saltyPlugin` (Webpack)](#saltyplugin-webpack) | `@salty-css/webpack` | Webpack loader + plugin. | [installation](https://salty-css.dev/docs/installation) |
104
+ | [`saltyIntegration`](#saltyintegration-astro) | `@salty-css/astro/integration` | Astro integration. | [installation](https://salty-css.dev/docs/installation) |
105
105
 
106
106
  ---
107
107
 
@@ -376,7 +376,7 @@ export default defineImport(
376
376
  '/fonts/inter.css', // public/ folder
377
377
  'https://fonts.googleapis.com/css2?family=Inter', // URL
378
378
  { url: './print.css', media: 'print' }, // media-conditional
379
- { url: './p3.css', supports: 'color(display-p3 1 1 1)' } // supports-conditional
379
+ { url: './p3.css', supports: 'color(display-p3 1 1 1)' }, // supports-conditional
380
380
  );
381
381
  ```
382
382
 
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ let e=require("@salty-css/core/compiler/helpers");var t={rules:{"no-variants-in-base":{meta:{type:`problem`,fixable:`code`,docs:{description:"Ensure `variants` are not nested inside `base` in styled calls",category:`Errors`,recommended:!0},messages:{nestedVariants:"`variants` should not be nested inside `base`."}},create(t){return(0,e.isSaltyFile)(t.filename)?{CallExpression:e=>{try{let{callee:n,arguments:r}=e;if(!(n.type===`Identifier`&&n.name===`styled`))return;let i=r[1];if(!i||i.type!==`ObjectExpression`)return;let a=i.properties.find(e=>e.type===`Property`&&e.key.type===`Identifier`&&e.key.name===`base`);if(!a)return;let{value:o}=a;if(o.type!==`ObjectExpression`)return;let s=o.properties.find(e=>e.type===`Property`&&e.key.type===`Identifier`&&e.key.name===`variants`);if(!s)return;t.report({node:s,messageId:`nestedVariants`,fix:e=>{if(!s.range)return null;let{sourceCode:n}=t,r=n.getText(s),c=i.properties.indexOf(a),l=i.properties[c];if(!l.range)return null;let u=[l.range[1],l.range[1]],d=[s.range[0]-1,s.range[1]];if(o.properties.at(-1)===s){let e=n.text.slice(s.range[1]).match(/^\s*,/);e&&(d[1]+=e[0].length)}return[e.removeRange(d),e.insertTextAfterRange(u,`, ${r}`)]}})}catch(e){console.log(`ESlint error`,e);return}}}:{}}},"must-be-exported":{meta:{type:`problem`,fixable:`code`,docs:{description:`Salty CSS related function calls or other values must be exported`,category:`Errors`,recommended:!0},messages:{mustBeExported:`Salty CSS function calls (styled, className, keyframes, defineX) must be exported — the compiler only picks up exports from .css.ts / .salty.ts / .styles.ts / .styled.ts files.`}},create(t){if(!(0,e.isSaltyFile)(t.filename))return{};function n(e){if(!e)return!1;if(e?.type===`CallExpression`)return!!(e.callee.type===`Identifier`&&[`styled`,`keyframes`,`className`].includes(e.callee.name)||e.callee.type===`Identifier`&&/^define[A-Z]/.test(e.callee.name))}function r(e){if(e.type===`VariableDeclaration`){let t=e.declarations[0];return t.type===`VariableDeclarator`?n(t.init):void 0}return!1}function i(e){let t=e.parent;return t.type===`ExportNamedDeclaration`||t.type===`ExportDefaultDeclaration`}return{VariableDeclaration:e=>{r(e)&&(i(e)||t.report({node:e,messageId:`mustBeExported`,fix:t=>t.insertTextBefore(e,`export `)}))},ExpressionStatement(e){e.type===`ExpressionStatement`&&n(e.expression)&&e.parent.type===`Program`&&t.report({node:e,messageId:`mustBeExported`,fix:t=>t.insertTextBefore(e,`export default `)})}}}}}};module.exports=t;
@@ -5,3 +5,4 @@ declare const eslintPluginCore: {
5
5
  };
6
6
  };
7
7
  export default eslintPluginCore;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,gBAAgB;;;;;CAKG,CAAC;AAE1B,eAAe,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,103 @@
1
+ import { isSaltyFile as e } from "@salty-css/core/compiler/helpers";
2
+ //#endregion
3
+ //#region src/index.ts
4
+ var t = { rules: {
5
+ "no-variants-in-base": {
6
+ meta: {
7
+ type: "problem",
8
+ fixable: "code",
9
+ docs: {
10
+ description: "Ensure `variants` are not nested inside `base` in styled calls",
11
+ category: "Errors",
12
+ recommended: !0
13
+ },
14
+ messages: { nestedVariants: "`variants` should not be nested inside `base`." }
15
+ },
16
+ create(t) {
17
+ return e(t.filename) ? { CallExpression: (e) => {
18
+ try {
19
+ let { callee: n, arguments: r } = e;
20
+ if (!(n.type === "Identifier" && n.name === "styled")) return;
21
+ let i = r[1];
22
+ if (!i || i.type !== "ObjectExpression") return;
23
+ let a = i.properties.find((e) => e.type === "Property" && e.key.type === "Identifier" && e.key.name === "base");
24
+ if (!a) return;
25
+ let { value: o } = a;
26
+ if (o.type !== "ObjectExpression") return;
27
+ let s = o.properties.find((e) => e.type === "Property" && e.key.type === "Identifier" && e.key.name === "variants");
28
+ if (!s) return;
29
+ t.report({
30
+ node: s,
31
+ messageId: "nestedVariants",
32
+ fix: (e) => {
33
+ if (!s.range) return null;
34
+ let { sourceCode: n } = t, r = n.getText(s), c = i.properties.indexOf(a), l = i.properties[c];
35
+ if (!l.range) return null;
36
+ let u = [l.range[1], l.range[1]], d = [s.range[0] - 1, s.range[1]];
37
+ if (o.properties.at(-1) === s) {
38
+ let e = n.text.slice(s.range[1]).match(/^\s*,/);
39
+ e && (d[1] += e[0].length);
40
+ }
41
+ return [e.removeRange(d), e.insertTextAfterRange(u, `, ${r}`)];
42
+ }
43
+ });
44
+ } catch (e) {
45
+ console.log("ESlint error", e);
46
+ return;
47
+ }
48
+ } } : {};
49
+ }
50
+ },
51
+ "must-be-exported": {
52
+ meta: {
53
+ type: "problem",
54
+ fixable: "code",
55
+ docs: {
56
+ description: "Salty CSS related function calls or other values must be exported",
57
+ category: "Errors",
58
+ recommended: !0
59
+ },
60
+ messages: { mustBeExported: "Salty CSS function calls (styled, className, keyframes, defineX) must be exported — the compiler only picks up exports from .css.ts / .salty.ts / .styles.ts / .styled.ts files." }
61
+ },
62
+ create(t) {
63
+ if (!e(t.filename)) return {};
64
+ function n(e) {
65
+ if (!e) return !1;
66
+ if (e?.type === "CallExpression") return !!(e.callee.type === "Identifier" && [
67
+ "styled",
68
+ "keyframes",
69
+ "className"
70
+ ].includes(e.callee.name) || e.callee.type === "Identifier" && /^define[A-Z]/.test(e.callee.name));
71
+ }
72
+ function r(e) {
73
+ if (e.type === "VariableDeclaration") {
74
+ let t = e.declarations[0];
75
+ return t.type === "VariableDeclarator" ? n(t.init) : void 0;
76
+ }
77
+ return !1;
78
+ }
79
+ function i(e) {
80
+ let t = e.parent;
81
+ return t.type === "ExportNamedDeclaration" || t.type === "ExportDefaultDeclaration";
82
+ }
83
+ return {
84
+ VariableDeclaration: (e) => {
85
+ r(e) && (i(e) || t.report({
86
+ node: e,
87
+ messageId: "mustBeExported",
88
+ fix: (t) => t.insertTextBefore(e, "export ")
89
+ }));
90
+ },
91
+ ExpressionStatement(e) {
92
+ e.type === "ExpressionStatement" && n(e.expression) && e.parent.type === "Program" && t.report({
93
+ node: e,
94
+ messageId: "mustBeExported",
95
+ fix: (t) => t.insertTextBefore(e, "export default ")
96
+ });
97
+ }
98
+ };
99
+ }
100
+ }
101
+ } };
102
+ //#endregion
103
+ export { t as default };
@@ -1,2 +1,3 @@
1
1
  import { Rule } from 'eslint';
2
2
  export declare const mustBeExported: Rule.RuleModule;
3
+ //# sourceMappingURL=must-be-exported.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"must-be-exported.d.ts","sourceRoot":"","sources":["../../src/rules/must-be-exported.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAInC,eAAO,MAAM,cAAc,EAAE,IAAI,CAAC,UAgFjC,CAAC"}
@@ -1,2 +1,3 @@
1
1
  import { Rule } from 'eslint';
2
2
  export declare const noVariantsInBase: Rule.RuleModule;
3
+ //# sourceMappingURL=no-variants-in-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-variants-in-base.d.ts","sourceRoot":"","sources":["../../src/rules/no-variants-in-base.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAInC,eAAO,MAAM,gBAAgB,EAAE,IAAI,CAAC,UAiFnC,CAAC"}
package/package.json CHANGED
@@ -1,16 +1,11 @@
1
1
  {
2
2
  "name": "@salty-css/eslint-plugin-core",
3
- "version": "0.2.1",
4
- "main": "./dist/index.js",
5
- "module": "./dist/index.mjs",
6
- "typings": "./dist/index.d.ts",
7
- "type": "module",
8
3
  "license": "MIT",
9
4
  "private": false,
10
5
  "publishConfig": {
11
6
  "access": "public"
12
7
  },
13
- "description": "ESLint plugin for Salty CSS",
8
+ "description": "Vite plugin for Salty CSS",
14
9
  "homepage": "https://salty-css.dev/",
15
10
  "repository": {
16
11
  "type": "git",
@@ -19,23 +14,34 @@
19
14
  "bugs": {
20
15
  "url": "https://github.com/margarita-form/salty-css/issues"
21
16
  },
22
- "files": [
23
- "**/*",
24
- "!**/*.tsbuildinfo"
25
- ],
17
+ "version": "0.2.2-refactor-vite-8.8",
18
+ "type": "module",
19
+ "scripts": {
20
+ "build": "vite build",
21
+ "test": "vitest run"
22
+ },
23
+ "dependencies": {
24
+ "@salty-css/core": "0.2.2-refactor-vite-8.8",
25
+ "@types/estree": "1.0.8",
26
+ "eslint": ">=9.x || >=8.x || >=7.x"
27
+ },
26
28
  "nx": {
27
- "sourceRoot": "libs/eslint-plugin-core/src",
28
- "name": "eslint-plugin-core"
29
+ "targets": {
30
+ "build": {
31
+ "dependsOn": [
32
+ "^build"
33
+ ]
34
+ }
35
+ }
29
36
  },
37
+ "files": [
38
+ "dist",
39
+ "README.md"
40
+ ],
30
41
  "exports": {
31
42
  ".": {
32
- "import": "./index.js",
33
- "require": "./index.cjs"
43
+ "import": "./dist/index.js",
44
+ "require": "./dist/index.cjs"
34
45
  }
35
- },
36
- "dependencies": {
37
- "@salty-css/core": "0.2.1",
38
- "@types/estree": "1.0.8",
39
- "eslint": ">=9.x || >=8.x || >=7.x"
40
46
  }
41
47
  }
package/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";const m=require("@salty-css/core/compiler/helpers"),I={meta:{type:"problem",fixable:"code",docs:{description:"Ensure `variants` are not nested inside `base` in styled calls",category:"Errors",recommended:!0},messages:{nestedVariants:"`variants` should not be nested inside `base`."}},create(n){return m.isSaltyFile(n.filename)?{CallExpression:o=>{try{const{callee:a,arguments:l}=o;if(!(a.type==="Identifier"&&a.name==="styled"))return;const t=l[1];if(!t||!(t.type==="ObjectExpression"))return;const i=t.properties.find(r=>r.type==="Property"&&r.key.type==="Identifier"&&r.key.name==="base");if(!i)return;const{value:u}=i;if(!(u.type==="ObjectExpression"))return;const s=u.properties.find(r=>r.type==="Property"&&r.key.type==="Identifier"&&r.key.name==="variants");if(!s)return;n.report({node:s,messageId:"nestedVariants",fix:r=>{if(!s.range)return null;const{sourceCode:y}=n,x=y.getText(s),b=t.properties.indexOf(i),f=t.properties[b];if(!f.range)return null;const S=[f.range[1],f.range[1]],p=[s.range[0]-1,s.range[1]];if(u.properties.at(-1)===s){const d=y.text.slice(s.range[1]).match(/^\s*,/);d&&(p[1]+=d[0].length)}return[r.removeRange(p),r.insertTextAfterRange(S,`, ${x}`)]}})}catch(a){console.log("ESlint error",a);return}}}:{}}},h={meta:{type:"problem",fixable:"code",docs:{description:"Salty CSS related function calls or other values must be exported",category:"Errors",recommended:!0},messages:{mustBeExported:"Salty CSS function calls (styled, className, keyframes, defineX) must be exported — the compiler only picks up exports from .css.ts / .salty.ts / .styles.ts / .styled.ts files."}},create(n){if(!m.isSaltyFile(n.filename))return{};function o(e){if(!e)return!1;if((e==null?void 0:e.type)!=="CallExpression")return;const t=["styled","keyframes","className"];if(e.callee.type==="Identifier"&&t.includes(e.callee.name))return!0;const c=/^define[A-Z]/;return!!(e.callee.type==="Identifier"&&c.test(e.callee.name))}function a(e){if(e.type==="VariableDeclaration"){const t=e.declarations[0];return t.type!=="VariableDeclarator"?void 0:o(t.init)}return!1}function l(e){const t=e.parent;return t.type==="ExportNamedDeclaration"||t.type==="ExportDefaultDeclaration"}return{VariableDeclaration:e=>{a(e)&&(l(e)||n.report({node:e,messageId:"mustBeExported",fix:t=>t.insertTextBefore(e,"export ")}))},ExpressionStatement(e){e.type!=="ExpressionStatement"||!o(e.expression)||!(e.parent.type==="Program")||n.report({node:e,messageId:"mustBeExported",fix:i=>i.insertTextBefore(e,"export default ")})}}}},v={rules:{"no-variants-in-base":I,"must-be-exported":h}};module.exports=v;
package/index.js DELETED
@@ -1,116 +0,0 @@
1
- import { isSaltyFile as d } from "@salty-css/core/compiler/helpers";
2
- const I = {
3
- meta: {
4
- type: "problem",
5
- fixable: "code",
6
- docs: {
7
- description: "Ensure `variants` are not nested inside `base` in styled calls",
8
- category: "Errors",
9
- recommended: !0
10
- },
11
- messages: {
12
- nestedVariants: "`variants` should not be nested inside `base`."
13
- }
14
- },
15
- create(a) {
16
- return d(a.filename) ? {
17
- CallExpression: (o) => {
18
- try {
19
- const { callee: n, arguments: l } = o;
20
- if (!(n.type === "Identifier" && n.name === "styled")) return;
21
- const t = l[1];
22
- if (!t || !(t.type === "ObjectExpression")) return;
23
- const i = t.properties.find((r) => r.type === "Property" && r.key.type === "Identifier" && r.key.name === "base");
24
- if (!i) return;
25
- const { value: u } = i;
26
- if (!(u.type === "ObjectExpression")) return;
27
- const s = u.properties.find(
28
- (r) => r.type === "Property" && r.key.type === "Identifier" && r.key.name === "variants"
29
- );
30
- if (!s) return;
31
- a.report({
32
- node: s,
33
- messageId: "nestedVariants",
34
- fix: (r) => {
35
- if (!s.range) return null;
36
- const { sourceCode: y } = a, x = y.getText(s), b = t.properties.indexOf(i), f = t.properties[b];
37
- if (!f.range) return null;
38
- const S = [f.range[1], f.range[1]], p = [
39
- s.range[0] - 1,
40
- // Include the preceding comma (if any)
41
- s.range[1]
42
- ];
43
- if (u.properties.at(-1) === s) {
44
- const m = y.text.slice(s.range[1]).match(/^\s*,/);
45
- m && (p[1] += m[0].length);
46
- }
47
- return [r.removeRange(p), r.insertTextAfterRange(S, `, ${x}`)];
48
- }
49
- });
50
- } catch (n) {
51
- console.log("ESlint error", n);
52
- return;
53
- }
54
- }
55
- } : {};
56
- }
57
- }, v = {
58
- meta: {
59
- type: "problem",
60
- fixable: "code",
61
- docs: {
62
- description: "Salty CSS related function calls or other values must be exported",
63
- category: "Errors",
64
- recommended: !0
65
- },
66
- messages: {
67
- mustBeExported: "Salty CSS function calls (styled, className, keyframes, defineX) must be exported — the compiler only picks up exports from .css.ts / .salty.ts / .styles.ts / .styled.ts files."
68
- }
69
- },
70
- create(a) {
71
- if (!d(a.filename)) return {};
72
- function o(e) {
73
- if (!e) return !1;
74
- if ((e == null ? void 0 : e.type) !== "CallExpression") return;
75
- const t = ["styled", "keyframes", "className"];
76
- if (e.callee.type === "Identifier" && t.includes(e.callee.name)) return !0;
77
- const c = /^define[A-Z]/;
78
- return !!(e.callee.type === "Identifier" && c.test(e.callee.name));
79
- }
80
- function n(e) {
81
- if (e.type === "VariableDeclaration") {
82
- const t = e.declarations[0];
83
- return t.type !== "VariableDeclarator" ? void 0 : o(t.init);
84
- }
85
- return !1;
86
- }
87
- function l(e) {
88
- const t = e.parent;
89
- return t.type === "ExportNamedDeclaration" || t.type === "ExportDefaultDeclaration";
90
- }
91
- return {
92
- VariableDeclaration: (e) => {
93
- n(e) && (l(e) || a.report({
94
- node: e,
95
- messageId: "mustBeExported",
96
- fix: (t) => t.insertTextBefore(e, "export ")
97
- }));
98
- },
99
- ExpressionStatement(e) {
100
- e.type !== "ExpressionStatement" || !o(e.expression) || !(e.parent.type === "Program") || a.report({
101
- node: e,
102
- messageId: "mustBeExported",
103
- fix: (i) => i.insertTextBefore(e, "export default ")
104
- });
105
- }
106
- };
107
- }
108
- }, k = {
109
- rules: {
110
- "no-variants-in-base": I,
111
- "must-be-exported": v
112
- }
113
- };
114
- export {
115
- k as default
116
- };