@salty-css/eslint-plugin-core 0.0.1-alpha.73 → 0.0.1-alpha.75

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/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";require("esbuild");require("child_process");require("path");require("fs");require("fs/promises");const x=["salty","css","styles","styled"],b=(s=[])=>new RegExp(`\\.(${[...x,...s].join("|")})\\.`),P=(s,c=[])=>b(c).test(s),v={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(s){return P(s.filename)?{CallExpression:u=>{try{const{callee:n,arguments:p}=u;if(!(n.type==="Identifier"&&n.name==="styled"))return;const r=p[1];if(!r||!(r.type==="ObjectExpression"))return;const a=r.properties.find(e=>e.type==="Property"&&e.key.type==="Identifier"&&e.key.name==="base");if(!a)return;const{value:i}=a;if(!(i.type==="ObjectExpression"))return;const t=i.properties.find(e=>e.type==="Property"&&e.key.type==="Identifier"&&e.key.name==="variants");if(!t)return;s.report({node:t,messageId:"nestedVariants",fix:e=>{if(!t.range)return null;const{sourceCode:l}=s,f=l.getText(t),g=r.properties.indexOf(a),o=r.properties[g];if(!o.range)return null;const m=[o.range[1],o.range[1]],y=[t.range[0]-1,t.range[1]];if(i.properties.at(-1)===t){const d=l.text.slice(t.range[1]).match(/^\s*,/);d&&(y[1]+=d[0].length)}return[e.removeRange(y),e.insertTextAfterRange(m,`, ${f}`)]}})}catch(n){console.log("ESlint error",n);return}}}:{}}},E={rules:{"no-variants-in-base":v}};module.exports=E;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("esbuild");require("child_process");require("path");require("fs");require("fs/promises");const x=["salty","css","styles","styled"],P=(r=[])=>new RegExp(`\\.(${[...x,...r].join("|")})\\.`),v=(r,l=[])=>P(l).test(r),E={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(r){return v(r.filename)?{CallExpression:g=>{try{const{callee:n,arguments:f}=g;if(!(n.type==="Identifier"&&n.name==="styled"))return;const s=f[1];if(!s||!(s.type==="ObjectExpression"))return;const a=s.properties.find(e=>e.type==="Property"&&e.key.type==="Identifier"&&e.key.name==="base");if(!a)return;const{value:i}=a;if(!(i.type==="ObjectExpression"))return;const t=i.properties.find(e=>e.type==="Property"&&e.key.type==="Identifier"&&e.key.name==="variants");if(!t)return;r.report({node:t,messageId:"nestedVariants",fix:e=>{if(!t.range)return null;const{sourceCode:c}=r,p=c.getText(t),m=s.properties.indexOf(a),o=s.properties[m];if(!o.range)return null;const b=[o.range[1],o.range[1]],u=[t.range[0]-1,t.range[1]];if(i.properties.at(-1)===t){const d=c.text.slice(t.range[1]).match(/^\s*,/);d&&(u[1]+=d[0].length)}return[e.removeRange(u),e.insertTextAfterRange(b,`, ${p}`)]}})}catch(n){console.log("ESlint error",n);return}}}:{}}},y={rules:{"no-variants-in-base":E},configs:{recommended:{rules:{"core/no-variants-in-base":"error"}}}};exports.default=y;exports.eslintPluginCore=y;
package/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- declare const _default: {
2
- rules: {
3
- 'no-variants-in-base': import("eslint").Rule.RuleModule;
4
- };
5
- };
6
- export default _default;
1
+ import { ESLint } from 'eslint';
2
+ export declare const eslintPluginCore: ESLint.Plugin;
3
+ export default eslintPluginCore;
package/index.js CHANGED
@@ -3,7 +3,7 @@ import "child_process";
3
3
  import "path";
4
4
  import "fs";
5
5
  import "fs/promises";
6
- const x = ["salty", "css", "styles", "styled"], b = (s = []) => new RegExp(`\\.(${[...x, ...s].join("|")})\\.`), P = (s, l = []) => b(l).test(s), v = {
6
+ const b = ["salty", "css", "styles", "styled"], x = (s = []) => new RegExp(`\\.(${[...b, ...s].join("|")})\\.`), P = (s, l = []) => x(l).test(s), v = {
7
7
  meta: {
8
8
  type: "problem",
9
9
  fixable: "code",
@@ -58,11 +58,19 @@ const x = ["salty", "css", "styles", "styled"], b = (s = []) => new RegExp(`\\.(
58
58
  }
59
59
  } : {};
60
60
  }
61
- }, j = {
61
+ }, T = {
62
62
  rules: {
63
63
  "no-variants-in-base": v
64
+ },
65
+ configs: {
66
+ recommended: {
67
+ rules: {
68
+ "core/no-variants-in-base": "error"
69
+ }
70
+ }
64
71
  }
65
72
  };
66
73
  export {
67
- j as default
74
+ T as default,
75
+ T as eslintPluginCore
68
76
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/eslint-plugin-core",
3
- "version": "0.0.1-alpha.73",
3
+ "version": "0.0.1-alpha.75",
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.73",
37
+ "@salty-css/core": "^0.0.1-alpha.75",
38
38
  "eslint": ">=9.x || >=8.x || >=7.x"
39
39
  }
40
40
  }