@tenphi/eslint-plugin-tasty 0.1.0
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/LICENSE +21 -0
- package/README.md +117 -0
- package/dist/_virtual/_rolldown/runtime.mjs +7 -0
- package/dist/config.mjs +118 -0
- package/dist/config.mjs.map +1 -0
- package/dist/configs.d.mts +8 -0
- package/dist/configs.mjs +36 -0
- package/dist/configs.mjs.map +1 -0
- package/dist/constants.mjs +700 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/context.mjs +180 -0
- package/dist/context.mjs.map +1 -0
- package/dist/create-rule.mjs +8 -0
- package/dist/create-rule.mjs.map +1 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.mjs +83 -0
- package/dist/index.mjs.map +1 -0
- package/dist/parser.mjs +46 -0
- package/dist/parser.mjs.map +1 -0
- package/dist/property-expectations.mjs +168 -0
- package/dist/property-expectations.mjs.map +1 -0
- package/dist/rules/consistent-token-usage.mjs +88 -0
- package/dist/rules/consistent-token-usage.mjs.map +1 -0
- package/dist/rules/known-property.mjs +55 -0
- package/dist/rules/known-property.mjs.map +1 -0
- package/dist/rules/no-duplicate-state.mjs +51 -0
- package/dist/rules/no-duplicate-state.mjs.map +1 -0
- package/dist/rules/no-important.mjs +44 -0
- package/dist/rules/no-important.mjs.map +1 -0
- package/dist/rules/no-nested-selector.mjs +40 -0
- package/dist/rules/no-nested-selector.mjs.map +1 -0
- package/dist/rules/no-nested-state-map.mjs +44 -0
- package/dist/rules/no-nested-state-map.mjs.map +1 -0
- package/dist/rules/no-raw-color-values.mjs +84 -0
- package/dist/rules/no-raw-color-values.mjs.map +1 -0
- package/dist/rules/no-runtime-styles-mutation.mjs +52 -0
- package/dist/rules/no-runtime-styles-mutation.mjs.map +1 -0
- package/dist/rules/no-styles-prop.mjs +25 -0
- package/dist/rules/no-styles-prop.mjs.map +1 -0
- package/dist/rules/no-unknown-state-alias.mjs +49 -0
- package/dist/rules/no-unknown-state-alias.mjs.map +1 -0
- package/dist/rules/prefer-shorthand-property.mjs +45 -0
- package/dist/rules/prefer-shorthand-property.mjs.map +1 -0
- package/dist/rules/require-default-state.mjs +47 -0
- package/dist/rules/require-default-state.mjs.map +1 -0
- package/dist/rules/static-no-dynamic-values.mjs +54 -0
- package/dist/rules/static-no-dynamic-values.mjs.map +1 -0
- package/dist/rules/static-valid-selector.mjs +51 -0
- package/dist/rules/static-valid-selector.mjs.map +1 -0
- package/dist/rules/valid-boolean-property.mjs +45 -0
- package/dist/rules/valid-boolean-property.mjs.map +1 -0
- package/dist/rules/valid-color-token.mjs +84 -0
- package/dist/rules/valid-color-token.mjs.map +1 -0
- package/dist/rules/valid-custom-property.mjs +69 -0
- package/dist/rules/valid-custom-property.mjs.map +1 -0
- package/dist/rules/valid-custom-unit.mjs +62 -0
- package/dist/rules/valid-custom-unit.mjs.map +1 -0
- package/dist/rules/valid-directional-modifier.mjs +71 -0
- package/dist/rules/valid-directional-modifier.mjs.map +1 -0
- package/dist/rules/valid-preset.mjs +64 -0
- package/dist/rules/valid-preset.mjs.map +1 -0
- package/dist/rules/valid-radius-shape.mjs +77 -0
- package/dist/rules/valid-radius-shape.mjs.map +1 -0
- package/dist/rules/valid-recipe.mjs +51 -0
- package/dist/rules/valid-recipe.mjs.map +1 -0
- package/dist/rules/valid-state-key.mjs +71 -0
- package/dist/rules/valid-state-key.mjs.map +1 -0
- package/dist/rules/valid-styles-structure.mjs +79 -0
- package/dist/rules/valid-styles-structure.mjs.map +1 -0
- package/dist/rules/valid-sub-element.mjs +46 -0
- package/dist/rules/valid-sub-element.mjs.map +1 -0
- package/dist/rules/valid-transition.mjs +62 -0
- package/dist/rules/valid-transition.mjs.map +1 -0
- package/dist/rules/valid-value.mjs +123 -0
- package/dist/rules/valid-value.mjs.map +1 -0
- package/dist/types.d.mts +25 -0
- package/dist/utils.mjs +152 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createRule } from "../create-rule.mjs";
|
|
2
|
+
import { SHORTHAND_MAPPING } from "../constants.mjs";
|
|
3
|
+
import { TastyContext } from "../context.mjs";
|
|
4
|
+
import { getKeyName } from "../utils.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/rules/prefer-shorthand-property.ts
|
|
7
|
+
var prefer_shorthand_property_default = createRule({
|
|
8
|
+
name: "prefer-shorthand-property",
|
|
9
|
+
meta: {
|
|
10
|
+
type: "suggestion",
|
|
11
|
+
docs: { description: "Suggest tasty shorthand when a native CSS property with a tasty alternative is used" },
|
|
12
|
+
messages: { preferShorthand: "Prefer tasty shorthand '{{alternative}}' instead of '{{native}}'." },
|
|
13
|
+
schema: []
|
|
14
|
+
},
|
|
15
|
+
defaultOptions: [],
|
|
16
|
+
create(context) {
|
|
17
|
+
const ctx = new TastyContext(context);
|
|
18
|
+
return {
|
|
19
|
+
ImportDeclaration(node) {
|
|
20
|
+
ctx.trackImport(node);
|
|
21
|
+
},
|
|
22
|
+
"CallExpression ObjectExpression"(node) {
|
|
23
|
+
if (!ctx.isStyleObject(node)) return;
|
|
24
|
+
for (const prop of node.properties) {
|
|
25
|
+
if (prop.type !== "Property" || prop.computed) continue;
|
|
26
|
+
const key = getKeyName(prop.key);
|
|
27
|
+
if (key === null) continue;
|
|
28
|
+
const mapping = SHORTHAND_MAPPING[key];
|
|
29
|
+
if (mapping) context.report({
|
|
30
|
+
node: prop.key,
|
|
31
|
+
messageId: "preferShorthand",
|
|
32
|
+
data: {
|
|
33
|
+
native: key,
|
|
34
|
+
alternative: mapping.hint
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { prefer_shorthand_property_default as default };
|
|
45
|
+
//# sourceMappingURL=prefer-shorthand-property.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-shorthand-property.mjs","names":[],"sources":["../../src/rules/prefer-shorthand-property.ts"],"sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { createRule } from '../create-rule.js';\nimport { TastyContext } from '../context.js';\nimport { getKeyName } from '../utils.js';\nimport { SHORTHAND_MAPPING } from '../constants.js';\n\ntype MessageIds = 'preferShorthand';\n\nexport default createRule<[], MessageIds>({\n name: 'prefer-shorthand-property',\n meta: {\n type: 'suggestion',\n docs: {\n description:\n 'Suggest tasty shorthand when a native CSS property with a tasty alternative is used',\n },\n messages: {\n preferShorthand:\n \"Prefer tasty shorthand '{{alternative}}' instead of '{{native}}'.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n const ctx = new TastyContext(context);\n\n return {\n ImportDeclaration(node) {\n ctx.trackImport(node);\n },\n\n 'CallExpression ObjectExpression'(node: TSESTree.ObjectExpression) {\n if (!ctx.isStyleObject(node)) return;\n\n for (const prop of node.properties) {\n if (prop.type !== 'Property' || prop.computed) continue;\n\n const key = getKeyName(prop.key);\n if (key === null) continue;\n\n const mapping = SHORTHAND_MAPPING[key];\n if (mapping) {\n context.report({\n node: prop.key,\n messageId: 'preferShorthand',\n data: { native: key, alternative: mapping.hint },\n });\n }\n }\n },\n };\n },\n});\n"],"mappings":";;;;;;AAQA,wCAAe,WAA2B;CACxC,MAAM;CACN,MAAM;EACJ,MAAM;EACN,MAAM,EACJ,aACE,uFACH;EACD,UAAU,EACR,iBACE,qEACH;EACD,QAAQ,EAAE;EACX;CACD,gBAAgB,EAAE;CAClB,OAAO,SAAS;EACd,MAAM,MAAM,IAAI,aAAa,QAAQ;AAErC,SAAO;GACL,kBAAkB,MAAM;AACtB,QAAI,YAAY,KAAK;;GAGvB,kCAAkC,MAAiC;AACjE,QAAI,CAAC,IAAI,cAAc,KAAK,CAAE;AAE9B,SAAK,MAAM,QAAQ,KAAK,YAAY;AAClC,SAAI,KAAK,SAAS,cAAc,KAAK,SAAU;KAE/C,MAAM,MAAM,WAAW,KAAK,IAAI;AAChC,SAAI,QAAQ,KAAM;KAElB,MAAM,UAAU,kBAAkB;AAClC,SAAI,QACF,SAAQ,OAAO;MACb,MAAM,KAAK;MACX,WAAW;MACX,MAAM;OAAE,QAAQ;OAAK,aAAa,QAAQ;OAAM;MACjD,CAAC;;;GAIT;;CAEJ,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRule } from "../create-rule.mjs";
|
|
2
|
+
import { TastyContext } from "../context.mjs";
|
|
3
|
+
import { getKeyName } from "../utils.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/rules/require-default-state.ts
|
|
6
|
+
var require_default_state_default = createRule({
|
|
7
|
+
name: "require-default-state",
|
|
8
|
+
meta: {
|
|
9
|
+
type: "suggestion",
|
|
10
|
+
docs: { description: "Warn when a state mapping object doesn't have a default ('') key" },
|
|
11
|
+
messages: { missingDefaultState: "State mapping for '{{property}}' has no default ('') value." },
|
|
12
|
+
schema: []
|
|
13
|
+
},
|
|
14
|
+
defaultOptions: [],
|
|
15
|
+
create(context) {
|
|
16
|
+
const ctx = new TastyContext(context);
|
|
17
|
+
return {
|
|
18
|
+
ImportDeclaration(node) {
|
|
19
|
+
ctx.trackImport(node);
|
|
20
|
+
},
|
|
21
|
+
"CallExpression ObjectExpression"(node) {
|
|
22
|
+
const styleCtx = ctx.getStyleContext(node);
|
|
23
|
+
if (!styleCtx) return;
|
|
24
|
+
if (styleCtx.isExtending) return;
|
|
25
|
+
for (const prop of node.properties) {
|
|
26
|
+
if (prop.type !== "Property" || prop.computed) continue;
|
|
27
|
+
const key = getKeyName(prop.key);
|
|
28
|
+
if (key === null) continue;
|
|
29
|
+
if (/^[A-Z@&$#]/.test(key)) continue;
|
|
30
|
+
if (prop.value.type !== "ObjectExpression") continue;
|
|
31
|
+
if (!prop.value.properties.some((p) => {
|
|
32
|
+
if (p.type !== "Property") return false;
|
|
33
|
+
return (p.key.type === "Literal" ? p.key.value : null) === "";
|
|
34
|
+
})) context.report({
|
|
35
|
+
node: prop.value,
|
|
36
|
+
messageId: "missingDefaultState",
|
|
37
|
+
data: { property: key }
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { require_default_state_default as default };
|
|
47
|
+
//# sourceMappingURL=require-default-state.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-default-state.mjs","names":[],"sources":["../../src/rules/require-default-state.ts"],"sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { createRule } from '../create-rule.js';\nimport { TastyContext } from '../context.js';\nimport { getKeyName } from '../utils.js';\n\ntype MessageIds = 'missingDefaultState';\n\nexport default createRule<[], MessageIds>({\n name: 'require-default-state',\n meta: {\n type: 'suggestion',\n docs: {\n description:\n \"Warn when a state mapping object doesn't have a default ('') key\",\n },\n messages: {\n missingDefaultState:\n \"State mapping for '{{property}}' has no default ('') value.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n const ctx = new TastyContext(context);\n\n return {\n ImportDeclaration(node) {\n ctx.trackImport(node);\n },\n\n 'CallExpression ObjectExpression'(node: TSESTree.ObjectExpression) {\n const styleCtx = ctx.getStyleContext(node);\n if (!styleCtx) return;\n\n // Skip if extending (omitting '' is intentional)\n if (styleCtx.isExtending) return;\n\n for (const prop of node.properties) {\n if (prop.type !== 'Property' || prop.computed) continue;\n\n const key = getKeyName(prop.key);\n if (key === null) continue;\n\n // Skip sub-elements and special keys\n if (/^[A-Z@&$#]/.test(key)) continue;\n\n if (prop.value.type !== 'ObjectExpression') continue;\n\n // Check if this object has a '' key\n const hasDefault = prop.value.properties.some((p) => {\n if (p.type !== 'Property') return false;\n const stateKey = p.key.type === 'Literal' ? p.key.value : null;\n return stateKey === '';\n });\n\n if (!hasDefault) {\n context.report({\n node: prop.value,\n messageId: 'missingDefaultState',\n data: { property: key },\n });\n }\n }\n },\n };\n },\n});\n"],"mappings":";;;;;AAOA,oCAAe,WAA2B;CACxC,MAAM;CACN,MAAM;EACJ,MAAM;EACN,MAAM,EACJ,aACE,oEACH;EACD,UAAU,EACR,qBACE,+DACH;EACD,QAAQ,EAAE;EACX;CACD,gBAAgB,EAAE;CAClB,OAAO,SAAS;EACd,MAAM,MAAM,IAAI,aAAa,QAAQ;AAErC,SAAO;GACL,kBAAkB,MAAM;AACtB,QAAI,YAAY,KAAK;;GAGvB,kCAAkC,MAAiC;IACjE,MAAM,WAAW,IAAI,gBAAgB,KAAK;AAC1C,QAAI,CAAC,SAAU;AAGf,QAAI,SAAS,YAAa;AAE1B,SAAK,MAAM,QAAQ,KAAK,YAAY;AAClC,SAAI,KAAK,SAAS,cAAc,KAAK,SAAU;KAE/C,MAAM,MAAM,WAAW,KAAK,IAAI;AAChC,SAAI,QAAQ,KAAM;AAGlB,SAAI,aAAa,KAAK,IAAI,CAAE;AAE5B,SAAI,KAAK,MAAM,SAAS,mBAAoB;AAS5C,SAAI,CANe,KAAK,MAAM,WAAW,MAAM,MAAM;AACnD,UAAI,EAAE,SAAS,WAAY,QAAO;AAElC,cADiB,EAAE,IAAI,SAAS,YAAY,EAAE,IAAI,QAAQ,UACtC;OACpB,CAGA,SAAQ,OAAO;MACb,MAAM,KAAK;MACX,WAAW;MACX,MAAM,EAAE,UAAU,KAAK;MACxB,CAAC;;;GAIT;;CAEJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createRule } from "../create-rule.mjs";
|
|
2
|
+
import { TastyContext } from "../context.mjs";
|
|
3
|
+
import { isStaticValue } from "../utils.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/rules/static-no-dynamic-values.ts
|
|
6
|
+
var static_no_dynamic_values_default = createRule({
|
|
7
|
+
name: "static-no-dynamic-values",
|
|
8
|
+
meta: {
|
|
9
|
+
type: "problem",
|
|
10
|
+
docs: { description: "Ensure all values in tastyStatic() calls are static literals" },
|
|
11
|
+
messages: { dynamicValue: "tastyStatic() values must be static (string, number, boolean, null, or objects/arrays of those). Dynamic expressions are not supported." },
|
|
12
|
+
schema: []
|
|
13
|
+
},
|
|
14
|
+
defaultOptions: [],
|
|
15
|
+
create(context) {
|
|
16
|
+
const ctx = new TastyContext(context);
|
|
17
|
+
function checkProperties(node) {
|
|
18
|
+
for (const prop of node.properties) {
|
|
19
|
+
if (prop.type === "SpreadElement") {
|
|
20
|
+
context.report({
|
|
21
|
+
node: prop,
|
|
22
|
+
messageId: "dynamicValue"
|
|
23
|
+
});
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (prop.computed) {
|
|
27
|
+
context.report({
|
|
28
|
+
node: prop.key,
|
|
29
|
+
messageId: "dynamicValue"
|
|
30
|
+
});
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (!isStaticValue(prop.value)) context.report({
|
|
34
|
+
node: prop.value,
|
|
35
|
+
messageId: "dynamicValue"
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
ImportDeclaration(node) {
|
|
41
|
+
ctx.trackImport(node);
|
|
42
|
+
},
|
|
43
|
+
"CallExpression ObjectExpression"(node) {
|
|
44
|
+
const styleCtx = ctx.getStyleContext(node);
|
|
45
|
+
if (!styleCtx || !styleCtx.isStaticCall) return;
|
|
46
|
+
checkProperties(node);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { static_no_dynamic_values_default as default };
|
|
54
|
+
//# sourceMappingURL=static-no-dynamic-values.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static-no-dynamic-values.mjs","names":[],"sources":["../../src/rules/static-no-dynamic-values.ts"],"sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { createRule } from '../create-rule.js';\nimport { TastyContext } from '../context.js';\nimport { isStaticValue } from '../utils.js';\n\ntype MessageIds = 'dynamicValue';\n\nexport default createRule<[], MessageIds>({\n name: 'static-no-dynamic-values',\n meta: {\n type: 'problem',\n docs: {\n description:\n 'Ensure all values in tastyStatic() calls are static literals',\n },\n messages: {\n dynamicValue:\n 'tastyStatic() values must be static (string, number, boolean, null, or objects/arrays of those). Dynamic expressions are not supported.',\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n const ctx = new TastyContext(context);\n\n function checkProperties(node: TSESTree.ObjectExpression): void {\n for (const prop of node.properties) {\n if (prop.type === 'SpreadElement') {\n context.report({ node: prop, messageId: 'dynamicValue' });\n continue;\n }\n\n if (prop.computed) {\n context.report({ node: prop.key, messageId: 'dynamicValue' });\n continue;\n }\n\n if (!isStaticValue(prop.value)) {\n context.report({ node: prop.value, messageId: 'dynamicValue' });\n }\n }\n }\n\n return {\n ImportDeclaration(node) {\n ctx.trackImport(node);\n },\n\n 'CallExpression ObjectExpression'(node: TSESTree.ObjectExpression) {\n const styleCtx = ctx.getStyleContext(node);\n if (!styleCtx || !styleCtx.isStaticCall) return;\n\n checkProperties(node);\n },\n };\n },\n});\n"],"mappings":";;;;;AAOA,uCAAe,WAA2B;CACxC,MAAM;CACN,MAAM;EACJ,MAAM;EACN,MAAM,EACJ,aACE,gEACH;EACD,UAAU,EACR,cACE,2IACH;EACD,QAAQ,EAAE;EACX;CACD,gBAAgB,EAAE;CAClB,OAAO,SAAS;EACd,MAAM,MAAM,IAAI,aAAa,QAAQ;EAErC,SAAS,gBAAgB,MAAuC;AAC9D,QAAK,MAAM,QAAQ,KAAK,YAAY;AAClC,QAAI,KAAK,SAAS,iBAAiB;AACjC,aAAQ,OAAO;MAAE,MAAM;MAAM,WAAW;MAAgB,CAAC;AACzD;;AAGF,QAAI,KAAK,UAAU;AACjB,aAAQ,OAAO;MAAE,MAAM,KAAK;MAAK,WAAW;MAAgB,CAAC;AAC7D;;AAGF,QAAI,CAAC,cAAc,KAAK,MAAM,CAC5B,SAAQ,OAAO;KAAE,MAAM,KAAK;KAAO,WAAW;KAAgB,CAAC;;;AAKrE,SAAO;GACL,kBAAkB,MAAM;AACtB,QAAI,YAAY,KAAK;;GAGvB,kCAAkC,MAAiC;IACjE,MAAM,WAAW,IAAI,gBAAgB,KAAK;AAC1C,QAAI,CAAC,YAAY,CAAC,SAAS,aAAc;AAEzC,oBAAgB,KAAK;;GAExB;;CAEJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createRule } from "../create-rule.mjs";
|
|
2
|
+
import { TastyContext } from "../context.mjs";
|
|
3
|
+
import { getStringValue, isValidSelector } from "../utils.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/rules/static-valid-selector.ts
|
|
6
|
+
var static_valid_selector_default = createRule({
|
|
7
|
+
name: "static-valid-selector",
|
|
8
|
+
meta: {
|
|
9
|
+
type: "problem",
|
|
10
|
+
docs: { description: "Validate the selector string in tastyStatic(selector, styles) calls" },
|
|
11
|
+
messages: {
|
|
12
|
+
invalidSelector: "Invalid CSS selector: {{reason}}",
|
|
13
|
+
selectorNotString: "tastyStatic() selector must be a string literal."
|
|
14
|
+
},
|
|
15
|
+
schema: []
|
|
16
|
+
},
|
|
17
|
+
defaultOptions: [],
|
|
18
|
+
create(context) {
|
|
19
|
+
const ctx = new TastyContext(context);
|
|
20
|
+
return {
|
|
21
|
+
ImportDeclaration(node) {
|
|
22
|
+
ctx.trackImport(node);
|
|
23
|
+
},
|
|
24
|
+
CallExpression(node) {
|
|
25
|
+
const imp = ctx.isTastyCall(node);
|
|
26
|
+
if (!imp || imp.importedName !== "tastyStatic") return;
|
|
27
|
+
if (node.arguments.length !== 2) return;
|
|
28
|
+
const firstArg = node.arguments[0];
|
|
29
|
+
const selectorValue = getStringValue(firstArg);
|
|
30
|
+
if (selectorValue === null) {
|
|
31
|
+
if (firstArg.type === "Identifier" || firstArg.type === "MemberExpression") return;
|
|
32
|
+
context.report({
|
|
33
|
+
node: firstArg,
|
|
34
|
+
messageId: "selectorNotString"
|
|
35
|
+
});
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const error = isValidSelector(selectorValue);
|
|
39
|
+
if (error) context.report({
|
|
40
|
+
node: firstArg,
|
|
41
|
+
messageId: "invalidSelector",
|
|
42
|
+
data: { reason: error }
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { static_valid_selector_default as default };
|
|
51
|
+
//# sourceMappingURL=static-valid-selector.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static-valid-selector.mjs","names":[],"sources":["../../src/rules/static-valid-selector.ts"],"sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { createRule } from '../create-rule.js';\nimport { TastyContext } from '../context.js';\nimport { getStringValue, isValidSelector } from '../utils.js';\n\ntype MessageIds = 'invalidSelector' | 'selectorNotString';\n\nexport default createRule<[], MessageIds>({\n name: 'static-valid-selector',\n meta: {\n type: 'problem',\n docs: {\n description:\n 'Validate the selector string in tastyStatic(selector, styles) calls',\n },\n messages: {\n invalidSelector: 'Invalid CSS selector: {{reason}}',\n selectorNotString: 'tastyStatic() selector must be a string literal.',\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n const ctx = new TastyContext(context);\n\n return {\n ImportDeclaration(node) {\n ctx.trackImport(node);\n },\n\n CallExpression(node: TSESTree.CallExpression) {\n const imp = ctx.isTastyCall(node);\n if (!imp || imp.importedName !== 'tastyStatic') return;\n\n // Only check selector mode: tastyStatic(selector, styles)\n if (node.arguments.length !== 2) return;\n\n const firstArg = node.arguments[0];\n\n // Must be a string literal\n const selectorValue = getStringValue(firstArg);\n if (selectorValue === null) {\n // Could be a StaticStyle object (extending), which is fine\n if (\n firstArg.type === 'Identifier' ||\n firstArg.type === 'MemberExpression'\n ) {\n return;\n }\n\n context.report({\n node: firstArg,\n messageId: 'selectorNotString',\n });\n return;\n }\n\n const error = isValidSelector(selectorValue);\n if (error) {\n context.report({\n node: firstArg,\n messageId: 'invalidSelector',\n data: { reason: error },\n });\n }\n },\n };\n },\n});\n"],"mappings":";;;;;AAOA,oCAAe,WAA2B;CACxC,MAAM;CACN,MAAM;EACJ,MAAM;EACN,MAAM,EACJ,aACE,uEACH;EACD,UAAU;GACR,iBAAiB;GACjB,mBAAmB;GACpB;EACD,QAAQ,EAAE;EACX;CACD,gBAAgB,EAAE;CAClB,OAAO,SAAS;EACd,MAAM,MAAM,IAAI,aAAa,QAAQ;AAErC,SAAO;GACL,kBAAkB,MAAM;AACtB,QAAI,YAAY,KAAK;;GAGvB,eAAe,MAA+B;IAC5C,MAAM,MAAM,IAAI,YAAY,KAAK;AACjC,QAAI,CAAC,OAAO,IAAI,iBAAiB,cAAe;AAGhD,QAAI,KAAK,UAAU,WAAW,EAAG;IAEjC,MAAM,WAAW,KAAK,UAAU;IAGhC,MAAM,gBAAgB,eAAe,SAAS;AAC9C,QAAI,kBAAkB,MAAM;AAE1B,SACE,SAAS,SAAS,gBAClB,SAAS,SAAS,mBAElB;AAGF,aAAQ,OAAO;MACb,MAAM;MACN,WAAW;MACZ,CAAC;AACF;;IAGF,MAAM,QAAQ,gBAAgB,cAAc;AAC5C,QAAI,MACF,SAAQ,OAAO;KACb,MAAM;KACN,WAAW;KACX,MAAM,EAAE,QAAQ,OAAO;KACxB,CAAC;;GAGP;;CAEJ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createRule } from "../create-rule.mjs";
|
|
2
|
+
import { BOOLEAN_TRUE_PROPERTIES } from "../constants.mjs";
|
|
3
|
+
import { TastyContext } from "../context.mjs";
|
|
4
|
+
import { getKeyName } from "../utils.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/rules/valid-boolean-property.ts
|
|
7
|
+
var valid_boolean_property_default = createRule({
|
|
8
|
+
name: "valid-boolean-property",
|
|
9
|
+
meta: {
|
|
10
|
+
type: "problem",
|
|
11
|
+
docs: { description: "Validate that true/false values are only used on properties that support them" },
|
|
12
|
+
messages: { invalidBooleanTrue: "Property '{{name}}' does not accept boolean true. Only these properties support it: {{allowed}}." },
|
|
13
|
+
schema: []
|
|
14
|
+
},
|
|
15
|
+
defaultOptions: [],
|
|
16
|
+
create(context) {
|
|
17
|
+
const ctx = new TastyContext(context);
|
|
18
|
+
return {
|
|
19
|
+
ImportDeclaration(node) {
|
|
20
|
+
ctx.trackImport(node);
|
|
21
|
+
},
|
|
22
|
+
"CallExpression ObjectExpression"(node) {
|
|
23
|
+
if (!ctx.isStyleObject(node)) return;
|
|
24
|
+
for (const prop of node.properties) {
|
|
25
|
+
if (prop.type !== "Property" || prop.computed) continue;
|
|
26
|
+
const key = getKeyName(prop.key);
|
|
27
|
+
if (key === null) continue;
|
|
28
|
+
if (/^[A-Z@&$#]/.test(key)) continue;
|
|
29
|
+
if (prop.value.type === "Literal" && prop.value.value === true && !BOOLEAN_TRUE_PROPERTIES.has(key)) context.report({
|
|
30
|
+
node: prop.value,
|
|
31
|
+
messageId: "invalidBooleanTrue",
|
|
32
|
+
data: {
|
|
33
|
+
name: key,
|
|
34
|
+
allowed: [...BOOLEAN_TRUE_PROPERTIES].join(", ")
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { valid_boolean_property_default as default };
|
|
45
|
+
//# sourceMappingURL=valid-boolean-property.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valid-boolean-property.mjs","names":[],"sources":["../../src/rules/valid-boolean-property.ts"],"sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { createRule } from '../create-rule.js';\nimport { TastyContext } from '../context.js';\nimport { getKeyName } from '../utils.js';\nimport { BOOLEAN_TRUE_PROPERTIES } from '../constants.js';\n\ntype MessageIds = 'invalidBooleanTrue';\n\nexport default createRule<[], MessageIds>({\n name: 'valid-boolean-property',\n meta: {\n type: 'problem',\n docs: {\n description:\n 'Validate that true/false values are only used on properties that support them',\n },\n messages: {\n invalidBooleanTrue:\n \"Property '{{name}}' does not accept boolean true. Only these properties support it: {{allowed}}.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n const ctx = new TastyContext(context);\n\n return {\n ImportDeclaration(node) {\n ctx.trackImport(node);\n },\n\n 'CallExpression ObjectExpression'(node: TSESTree.ObjectExpression) {\n if (!ctx.isStyleObject(node)) return;\n\n for (const prop of node.properties) {\n if (prop.type !== 'Property' || prop.computed) continue;\n\n const key = getKeyName(prop.key);\n if (key === null) continue;\n\n // Skip sub-elements and special keys\n if (/^[A-Z@&$#]/.test(key)) continue;\n\n // Check for true literal — false is always valid (tombstone)\n if (\n prop.value.type === 'Literal' &&\n prop.value.value === true &&\n !BOOLEAN_TRUE_PROPERTIES.has(key)\n ) {\n context.report({\n node: prop.value,\n messageId: 'invalidBooleanTrue',\n data: {\n name: key,\n allowed: [...BOOLEAN_TRUE_PROPERTIES].join(', '),\n },\n });\n }\n }\n },\n };\n },\n});\n"],"mappings":";;;;;;AAQA,qCAAe,WAA2B;CACxC,MAAM;CACN,MAAM;EACJ,MAAM;EACN,MAAM,EACJ,aACE,iFACH;EACD,UAAU,EACR,oBACE,oGACH;EACD,QAAQ,EAAE;EACX;CACD,gBAAgB,EAAE;CAClB,OAAO,SAAS;EACd,MAAM,MAAM,IAAI,aAAa,QAAQ;AAErC,SAAO;GACL,kBAAkB,MAAM;AACtB,QAAI,YAAY,KAAK;;GAGvB,kCAAkC,MAAiC;AACjE,QAAI,CAAC,IAAI,cAAc,KAAK,CAAE;AAE9B,SAAK,MAAM,QAAQ,KAAK,YAAY;AAClC,SAAI,KAAK,SAAS,cAAc,KAAK,SAAU;KAE/C,MAAM,MAAM,WAAW,KAAK,IAAI;AAChC,SAAI,QAAQ,KAAM;AAGlB,SAAI,aAAa,KAAK,IAAI,CAAE;AAG5B,SACE,KAAK,MAAM,SAAS,aACpB,KAAK,MAAM,UAAU,QACrB,CAAC,wBAAwB,IAAI,IAAI,CAEjC,SAAQ,OAAO;MACb,MAAM,KAAK;MACX,WAAW;MACX,MAAM;OACJ,MAAM;OACN,SAAS,CAAC,GAAG,wBAAwB,CAAC,KAAK,KAAK;OACjD;MACF,CAAC;;;GAIT;;CAEJ,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createRule } from "../create-rule.mjs";
|
|
2
|
+
import { TastyContext } from "../context.mjs";
|
|
3
|
+
import { getKeyName, getStringValue, isRawHexColor, validateColorTokenSyntax } from "../utils.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/rules/valid-color-token.ts
|
|
6
|
+
var valid_color_token_default = createRule({
|
|
7
|
+
name: "valid-color-token",
|
|
8
|
+
meta: {
|
|
9
|
+
type: "problem",
|
|
10
|
+
docs: { description: "Validate color token syntax and existence" },
|
|
11
|
+
messages: {
|
|
12
|
+
invalidSyntax: "Invalid color token '{{token}}': {{reason}}.",
|
|
13
|
+
unknownToken: "Unknown color token '{{token}}'."
|
|
14
|
+
},
|
|
15
|
+
schema: []
|
|
16
|
+
},
|
|
17
|
+
defaultOptions: [],
|
|
18
|
+
create(context) {
|
|
19
|
+
const ctx = new TastyContext(context);
|
|
20
|
+
const fileColorTokens = /* @__PURE__ */ new Set();
|
|
21
|
+
function collectLocalTokens(node) {
|
|
22
|
+
for (const prop of node.properties) {
|
|
23
|
+
if (prop.type !== "Property" || prop.computed) continue;
|
|
24
|
+
const key = getKeyName(prop.key);
|
|
25
|
+
if (key && key.startsWith("#") && !key.startsWith("##")) fileColorTokens.add(key);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function checkColorTokensInValue(value, node) {
|
|
29
|
+
const tokenRegex = /##?[a-zA-Z][a-zA-Z0-9-]*(?:\.\$?[a-zA-Z0-9-]+)?/g;
|
|
30
|
+
let match;
|
|
31
|
+
while ((match = tokenRegex.exec(value)) !== null) {
|
|
32
|
+
const token = match[0];
|
|
33
|
+
if (isRawHexColor(token)) continue;
|
|
34
|
+
const syntaxError = validateColorTokenSyntax(token);
|
|
35
|
+
if (syntaxError) {
|
|
36
|
+
context.report({
|
|
37
|
+
node,
|
|
38
|
+
messageId: "invalidSyntax",
|
|
39
|
+
data: {
|
|
40
|
+
token,
|
|
41
|
+
reason: syntaxError
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (ctx.config.tokens === false) continue;
|
|
47
|
+
const baseName = token.startsWith("##") ? "#" + token.slice(2).split(".")[0] : "#" + token.slice(1).split(".")[0];
|
|
48
|
+
if (baseName === "#current") continue;
|
|
49
|
+
if (!fileColorTokens.has(baseName) && !(Array.isArray(ctx.config.tokens) && ctx.config.tokens.includes(baseName))) {
|
|
50
|
+
if (Array.isArray(ctx.config.tokens) && ctx.config.tokens.length > 0) context.report({
|
|
51
|
+
node,
|
|
52
|
+
messageId: "unknownToken",
|
|
53
|
+
data: { token }
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
ImportDeclaration(node) {
|
|
60
|
+
ctx.trackImport(node);
|
|
61
|
+
},
|
|
62
|
+
"CallExpression ObjectExpression"(node) {
|
|
63
|
+
if (!ctx.isStyleObject(node)) return;
|
|
64
|
+
collectLocalTokens(node);
|
|
65
|
+
for (const prop of node.properties) {
|
|
66
|
+
if (prop.type !== "Property") continue;
|
|
67
|
+
if (prop.value.type === "Literal") {
|
|
68
|
+
const str = getStringValue(prop.value);
|
|
69
|
+
if (str && str.includes("#")) checkColorTokensInValue(str, prop.value);
|
|
70
|
+
}
|
|
71
|
+
if (prop.value.type === "ObjectExpression") for (const stateProp of prop.value.properties) {
|
|
72
|
+
if (stateProp.type !== "Property") continue;
|
|
73
|
+
const str = getStringValue(stateProp.value);
|
|
74
|
+
if (str && str.includes("#")) checkColorTokensInValue(str, stateProp.value);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
export { valid_color_token_default as default };
|
|
84
|
+
//# sourceMappingURL=valid-color-token.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valid-color-token.mjs","names":[],"sources":["../../src/rules/valid-color-token.ts"],"sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { createRule } from '../create-rule.js';\nimport { TastyContext } from '../context.js';\nimport {\n getKeyName,\n getStringValue,\n validateColorTokenSyntax,\n isRawHexColor,\n} from '../utils.js';\n\ntype MessageIds = 'invalidSyntax' | 'unknownToken';\n\nexport default createRule<[], MessageIds>({\n name: 'valid-color-token',\n meta: {\n type: 'problem',\n docs: {\n description: 'Validate color token syntax and existence',\n },\n messages: {\n invalidSyntax: \"Invalid color token '{{token}}': {{reason}}.\",\n unknownToken: \"Unknown color token '{{token}}'.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n const ctx = new TastyContext(context);\n const fileColorTokens = new Set<string>();\n\n function collectLocalTokens(node: TSESTree.ObjectExpression): void {\n for (const prop of node.properties) {\n if (prop.type !== 'Property' || prop.computed) continue;\n const key = getKeyName(prop.key);\n if (key && key.startsWith('#') && !key.startsWith('##')) {\n fileColorTokens.add(key);\n }\n }\n }\n\n function checkColorTokensInValue(value: string, node: TSESTree.Node): void {\n // Match color token references: #name or #name.N or ##name\n const tokenRegex = /##?[a-zA-Z][a-zA-Z0-9-]*(?:\\.\\$?[a-zA-Z0-9-]+)?/g;\n let match;\n\n while ((match = tokenRegex.exec(value)) !== null) {\n const token = match[0];\n\n // Skip raw hex colors\n if (isRawHexColor(token)) continue;\n\n // Check syntax\n const syntaxError = validateColorTokenSyntax(token);\n if (syntaxError) {\n context.report({\n node,\n messageId: 'invalidSyntax',\n data: { token, reason: syntaxError },\n });\n continue;\n }\n\n // Check existence (if tokens config is not false)\n if (ctx.config.tokens === false) continue;\n\n const baseName = token.startsWith('##')\n ? '#' + token.slice(2).split('.')[0]\n : '#' + token.slice(1).split('.')[0];\n\n if (baseName === '#current') continue;\n\n if (\n !fileColorTokens.has(baseName) &&\n !(\n Array.isArray(ctx.config.tokens) &&\n ctx.config.tokens.includes(baseName)\n )\n ) {\n // Only warn if config.tokens is a non-empty array\n if (\n Array.isArray(ctx.config.tokens) &&\n ctx.config.tokens.length > 0\n ) {\n context.report({\n node,\n messageId: 'unknownToken',\n data: { token },\n });\n }\n }\n }\n }\n\n return {\n ImportDeclaration(node) {\n ctx.trackImport(node);\n },\n\n 'CallExpression ObjectExpression'(node: TSESTree.ObjectExpression) {\n if (!ctx.isStyleObject(node)) return;\n collectLocalTokens(node);\n\n for (const prop of node.properties) {\n if (prop.type !== 'Property') continue;\n\n // Check string values for color tokens\n if (prop.value.type === 'Literal') {\n const str = getStringValue(prop.value);\n if (str && str.includes('#')) {\n checkColorTokensInValue(str, prop.value);\n }\n }\n\n // Check state map values\n if (prop.value.type === 'ObjectExpression') {\n for (const stateProp of prop.value.properties) {\n if (stateProp.type !== 'Property') continue;\n const str = getStringValue(stateProp.value);\n if (str && str.includes('#')) {\n checkColorTokensInValue(str, stateProp.value);\n }\n }\n }\n }\n },\n };\n },\n});\n"],"mappings":";;;;;AAYA,gCAAe,WAA2B;CACxC,MAAM;CACN,MAAM;EACJ,MAAM;EACN,MAAM,EACJ,aAAa,6CACd;EACD,UAAU;GACR,eAAe;GACf,cAAc;GACf;EACD,QAAQ,EAAE;EACX;CACD,gBAAgB,EAAE;CAClB,OAAO,SAAS;EACd,MAAM,MAAM,IAAI,aAAa,QAAQ;EACrC,MAAM,kCAAkB,IAAI,KAAa;EAEzC,SAAS,mBAAmB,MAAuC;AACjE,QAAK,MAAM,QAAQ,KAAK,YAAY;AAClC,QAAI,KAAK,SAAS,cAAc,KAAK,SAAU;IAC/C,MAAM,MAAM,WAAW,KAAK,IAAI;AAChC,QAAI,OAAO,IAAI,WAAW,IAAI,IAAI,CAAC,IAAI,WAAW,KAAK,CACrD,iBAAgB,IAAI,IAAI;;;EAK9B,SAAS,wBAAwB,OAAe,MAA2B;GAEzE,MAAM,aAAa;GACnB,IAAI;AAEJ,WAAQ,QAAQ,WAAW,KAAK,MAAM,MAAM,MAAM;IAChD,MAAM,QAAQ,MAAM;AAGpB,QAAI,cAAc,MAAM,CAAE;IAG1B,MAAM,cAAc,yBAAyB,MAAM;AACnD,QAAI,aAAa;AACf,aAAQ,OAAO;MACb;MACA,WAAW;MACX,MAAM;OAAE;OAAO,QAAQ;OAAa;MACrC,CAAC;AACF;;AAIF,QAAI,IAAI,OAAO,WAAW,MAAO;IAEjC,MAAM,WAAW,MAAM,WAAW,KAAK,GACnC,MAAM,MAAM,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,KAChC,MAAM,MAAM,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC;AAEpC,QAAI,aAAa,WAAY;AAE7B,QACE,CAAC,gBAAgB,IAAI,SAAS,IAC9B,EACE,MAAM,QAAQ,IAAI,OAAO,OAAO,IAChC,IAAI,OAAO,OAAO,SAAS,SAAS,GAItC;SACE,MAAM,QAAQ,IAAI,OAAO,OAAO,IAChC,IAAI,OAAO,OAAO,SAAS,EAE3B,SAAQ,OAAO;MACb;MACA,WAAW;MACX,MAAM,EAAE,OAAO;MAChB,CAAC;;;;AAMV,SAAO;GACL,kBAAkB,MAAM;AACtB,QAAI,YAAY,KAAK;;GAGvB,kCAAkC,MAAiC;AACjE,QAAI,CAAC,IAAI,cAAc,KAAK,CAAE;AAC9B,uBAAmB,KAAK;AAExB,SAAK,MAAM,QAAQ,KAAK,YAAY;AAClC,SAAI,KAAK,SAAS,WAAY;AAG9B,SAAI,KAAK,MAAM,SAAS,WAAW;MACjC,MAAM,MAAM,eAAe,KAAK,MAAM;AACtC,UAAI,OAAO,IAAI,SAAS,IAAI,CAC1B,yBAAwB,KAAK,KAAK,MAAM;;AAK5C,SAAI,KAAK,MAAM,SAAS,mBACtB,MAAK,MAAM,aAAa,KAAK,MAAM,YAAY;AAC7C,UAAI,UAAU,SAAS,WAAY;MACnC,MAAM,MAAM,eAAe,UAAU,MAAM;AAC3C,UAAI,OAAO,IAAI,SAAS,IAAI,CAC1B,yBAAwB,KAAK,UAAU,MAAM;;;;GAMxD;;CAEJ,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { createRule } from "../create-rule.mjs";
|
|
2
|
+
import { TastyContext } from "../context.mjs";
|
|
3
|
+
import { getKeyName, getStringValue } from "../utils.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/rules/valid-custom-property.ts
|
|
6
|
+
const CUSTOM_PROP_REGEX = /\$\$?[a-zA-Z][a-zA-Z0-9-]*/g;
|
|
7
|
+
var valid_custom_property_default = createRule({
|
|
8
|
+
name: "valid-custom-property",
|
|
9
|
+
meta: {
|
|
10
|
+
type: "suggestion",
|
|
11
|
+
docs: { description: "Validate $name custom property references" },
|
|
12
|
+
messages: {
|
|
13
|
+
invalidSyntax: "Invalid custom property syntax '{{token}}'.",
|
|
14
|
+
unknownProperty: "Unknown custom property '{{token}}'."
|
|
15
|
+
},
|
|
16
|
+
schema: []
|
|
17
|
+
},
|
|
18
|
+
defaultOptions: [],
|
|
19
|
+
create(context) {
|
|
20
|
+
const ctx = new TastyContext(context);
|
|
21
|
+
const fileCustomProperties = /* @__PURE__ */ new Set();
|
|
22
|
+
function collectLocalProperties(node) {
|
|
23
|
+
for (const prop of node.properties) {
|
|
24
|
+
if (prop.type !== "Property" || prop.computed) continue;
|
|
25
|
+
const key = getKeyName(prop.key);
|
|
26
|
+
if (key && key.startsWith("$") && !key.startsWith("$$")) fileCustomProperties.add(key);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function checkValue(value, node) {
|
|
30
|
+
if (ctx.config.tokens === false) return;
|
|
31
|
+
let match;
|
|
32
|
+
CUSTOM_PROP_REGEX.lastIndex = 0;
|
|
33
|
+
while ((match = CUSTOM_PROP_REGEX.exec(value)) !== null) {
|
|
34
|
+
const token = match[0];
|
|
35
|
+
const baseName = token.startsWith("$$") ? "$" + token.slice(2) : token;
|
|
36
|
+
if (fileCustomProperties.has(baseName)) continue;
|
|
37
|
+
if (Array.isArray(ctx.config.tokens) && ctx.config.tokens.includes(baseName)) continue;
|
|
38
|
+
if (Array.isArray(ctx.config.tokens) && ctx.config.tokens.length > 0) context.report({
|
|
39
|
+
node,
|
|
40
|
+
messageId: "unknownProperty",
|
|
41
|
+
data: { token }
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
ImportDeclaration(node) {
|
|
47
|
+
ctx.trackImport(node);
|
|
48
|
+
},
|
|
49
|
+
"CallExpression ObjectExpression"(node) {
|
|
50
|
+
if (!ctx.isStyleObject(node)) return;
|
|
51
|
+
collectLocalProperties(node);
|
|
52
|
+
for (const prop of node.properties) {
|
|
53
|
+
if (prop.type !== "Property") continue;
|
|
54
|
+
const str = getStringValue(prop.value);
|
|
55
|
+
if (str && str.includes("$")) checkValue(str, prop.value);
|
|
56
|
+
if (prop.value.type === "ObjectExpression") for (const stateProp of prop.value.properties) {
|
|
57
|
+
if (stateProp.type !== "Property") continue;
|
|
58
|
+
const stateStr = getStringValue(stateProp.value);
|
|
59
|
+
if (stateStr && stateStr.includes("$")) checkValue(stateStr, stateProp.value);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { valid_custom_property_default as default };
|
|
69
|
+
//# sourceMappingURL=valid-custom-property.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valid-custom-property.mjs","names":[],"sources":["../../src/rules/valid-custom-property.ts"],"sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { createRule } from '../create-rule.js';\nimport { TastyContext } from '../context.js';\nimport { getKeyName, getStringValue } from '../utils.js';\n\ntype MessageIds = 'invalidSyntax' | 'unknownProperty';\n\nconst CUSTOM_PROP_REGEX = /\\$\\$?[a-zA-Z][a-zA-Z0-9-]*/g;\n\nexport default createRule<[], MessageIds>({\n name: 'valid-custom-property',\n meta: {\n type: 'suggestion',\n docs: {\n description: 'Validate $name custom property references',\n },\n messages: {\n invalidSyntax: \"Invalid custom property syntax '{{token}}'.\",\n unknownProperty: \"Unknown custom property '{{token}}'.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n const ctx = new TastyContext(context);\n const fileCustomProperties = new Set<string>();\n\n function collectLocalProperties(node: TSESTree.ObjectExpression): void {\n for (const prop of node.properties) {\n if (prop.type !== 'Property' || prop.computed) continue;\n const key = getKeyName(prop.key);\n if (key && key.startsWith('$') && !key.startsWith('$$')) {\n fileCustomProperties.add(key);\n }\n }\n }\n\n function checkValue(value: string, node: TSESTree.Node): void {\n if (ctx.config.tokens === false) return;\n\n let match;\n CUSTOM_PROP_REGEX.lastIndex = 0;\n\n while ((match = CUSTOM_PROP_REGEX.exec(value)) !== null) {\n const token = match[0];\n const baseName = token.startsWith('$$') ? '$' + token.slice(2) : token;\n\n if (fileCustomProperties.has(baseName)) continue;\n\n if (\n Array.isArray(ctx.config.tokens) &&\n ctx.config.tokens.includes(baseName)\n ) {\n continue;\n }\n\n if (Array.isArray(ctx.config.tokens) && ctx.config.tokens.length > 0) {\n context.report({\n node,\n messageId: 'unknownProperty',\n data: { token },\n });\n }\n }\n }\n\n return {\n ImportDeclaration(node) {\n ctx.trackImport(node);\n },\n\n 'CallExpression ObjectExpression'(node: TSESTree.ObjectExpression) {\n if (!ctx.isStyleObject(node)) return;\n collectLocalProperties(node);\n\n for (const prop of node.properties) {\n if (prop.type !== 'Property') continue;\n\n const str = getStringValue(prop.value);\n if (str && str.includes('$')) {\n checkValue(str, prop.value);\n }\n\n if (prop.value.type === 'ObjectExpression') {\n for (const stateProp of prop.value.properties) {\n if (stateProp.type !== 'Property') continue;\n const stateStr = getStringValue(stateProp.value);\n if (stateStr && stateStr.includes('$')) {\n checkValue(stateStr, stateProp.value);\n }\n }\n }\n }\n },\n };\n },\n});\n"],"mappings":";;;;;AAOA,MAAM,oBAAoB;AAE1B,oCAAe,WAA2B;CACxC,MAAM;CACN,MAAM;EACJ,MAAM;EACN,MAAM,EACJ,aAAa,6CACd;EACD,UAAU;GACR,eAAe;GACf,iBAAiB;GAClB;EACD,QAAQ,EAAE;EACX;CACD,gBAAgB,EAAE;CAClB,OAAO,SAAS;EACd,MAAM,MAAM,IAAI,aAAa,QAAQ;EACrC,MAAM,uCAAuB,IAAI,KAAa;EAE9C,SAAS,uBAAuB,MAAuC;AACrE,QAAK,MAAM,QAAQ,KAAK,YAAY;AAClC,QAAI,KAAK,SAAS,cAAc,KAAK,SAAU;IAC/C,MAAM,MAAM,WAAW,KAAK,IAAI;AAChC,QAAI,OAAO,IAAI,WAAW,IAAI,IAAI,CAAC,IAAI,WAAW,KAAK,CACrD,sBAAqB,IAAI,IAAI;;;EAKnC,SAAS,WAAW,OAAe,MAA2B;AAC5D,OAAI,IAAI,OAAO,WAAW,MAAO;GAEjC,IAAI;AACJ,qBAAkB,YAAY;AAE9B,WAAQ,QAAQ,kBAAkB,KAAK,MAAM,MAAM,MAAM;IACvD,MAAM,QAAQ,MAAM;IACpB,MAAM,WAAW,MAAM,WAAW,KAAK,GAAG,MAAM,MAAM,MAAM,EAAE,GAAG;AAEjE,QAAI,qBAAqB,IAAI,SAAS,CAAE;AAExC,QACE,MAAM,QAAQ,IAAI,OAAO,OAAO,IAChC,IAAI,OAAO,OAAO,SAAS,SAAS,CAEpC;AAGF,QAAI,MAAM,QAAQ,IAAI,OAAO,OAAO,IAAI,IAAI,OAAO,OAAO,SAAS,EACjE,SAAQ,OAAO;KACb;KACA,WAAW;KACX,MAAM,EAAE,OAAO;KAChB,CAAC;;;AAKR,SAAO;GACL,kBAAkB,MAAM;AACtB,QAAI,YAAY,KAAK;;GAGvB,kCAAkC,MAAiC;AACjE,QAAI,CAAC,IAAI,cAAc,KAAK,CAAE;AAC9B,2BAAuB,KAAK;AAE5B,SAAK,MAAM,QAAQ,KAAK,YAAY;AAClC,SAAI,KAAK,SAAS,WAAY;KAE9B,MAAM,MAAM,eAAe,KAAK,MAAM;AACtC,SAAI,OAAO,IAAI,SAAS,IAAI,CAC1B,YAAW,KAAK,KAAK,MAAM;AAG7B,SAAI,KAAK,MAAM,SAAS,mBACtB,MAAK,MAAM,aAAa,KAAK,MAAM,YAAY;AAC7C,UAAI,UAAU,SAAS,WAAY;MACnC,MAAM,WAAW,eAAe,UAAU,MAAM;AAChD,UAAI,YAAY,SAAS,SAAS,IAAI,CACpC,YAAW,UAAU,UAAU,MAAM;;;;GAMhD;;CAEJ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createRule } from "../create-rule.mjs";
|
|
2
|
+
import { TastyContext } from "../context.mjs";
|
|
3
|
+
import { extractCustomUnit, getStringValue, isValidUnit } from "../utils.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/rules/valid-custom-unit.ts
|
|
6
|
+
var valid_custom_unit_default = createRule({
|
|
7
|
+
name: "valid-custom-unit",
|
|
8
|
+
meta: {
|
|
9
|
+
type: "problem",
|
|
10
|
+
docs: { description: "Validate that custom units in style values are recognized" },
|
|
11
|
+
messages: { unknownUnit: "Unknown unit '{{unit}}' in value '{{value}}'." },
|
|
12
|
+
schema: []
|
|
13
|
+
},
|
|
14
|
+
defaultOptions: [],
|
|
15
|
+
create(context) {
|
|
16
|
+
const ctx = new TastyContext(context);
|
|
17
|
+
function checkUnitsInValue(value, node) {
|
|
18
|
+
if (ctx.config.units === false) return;
|
|
19
|
+
const tokens = value.split(/\s+/);
|
|
20
|
+
for (const token of tokens) {
|
|
21
|
+
if (token.startsWith("#") || token.startsWith("$") || token.startsWith("@") || token.includes("(") || token.includes(")") || token === "true" || token === "false" || token === "none" || token === "auto" || token === "inherit" || token === "initial" || token === "unset" || token === "revert") continue;
|
|
22
|
+
const unit = extractCustomUnit(token);
|
|
23
|
+
if (unit && !isValidUnit(unit, ctx.config)) context.report({
|
|
24
|
+
node,
|
|
25
|
+
messageId: "unknownUnit",
|
|
26
|
+
data: {
|
|
27
|
+
unit,
|
|
28
|
+
value: token
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function checkNode(node) {
|
|
34
|
+
const str = getStringValue(node);
|
|
35
|
+
if (str) checkUnitsInValue(str, node);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
ImportDeclaration(node) {
|
|
39
|
+
ctx.trackImport(node);
|
|
40
|
+
},
|
|
41
|
+
"CallExpression ObjectExpression Property"(node) {
|
|
42
|
+
const objExpr = node.parent;
|
|
43
|
+
const callExpr = objExpr.parent;
|
|
44
|
+
if (callExpr?.type !== "CallExpression" && callExpr?.type !== "Property") return;
|
|
45
|
+
let current = objExpr;
|
|
46
|
+
while (current) {
|
|
47
|
+
if (current.type === "ObjectExpression" && ctx.isStyleObject(current)) break;
|
|
48
|
+
current = current.parent;
|
|
49
|
+
}
|
|
50
|
+
if (!current) return;
|
|
51
|
+
checkNode(node.value);
|
|
52
|
+
if (node.value.type === "ObjectExpression") {
|
|
53
|
+
for (const stateProp of node.value.properties) if (stateProp.type === "Property") checkNode(stateProp.value);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { valid_custom_unit_default as default };
|
|
62
|
+
//# sourceMappingURL=valid-custom-unit.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valid-custom-unit.mjs","names":[],"sources":["../../src/rules/valid-custom-unit.ts"],"sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { createRule } from '../create-rule.js';\nimport { TastyContext } from '../context.js';\nimport { getStringValue, extractCustomUnit, isValidUnit } from '../utils.js';\n\ntype MessageIds = 'unknownUnit';\n\nexport default createRule<[], MessageIds>({\n name: 'valid-custom-unit',\n meta: {\n type: 'problem',\n docs: {\n description: 'Validate that custom units in style values are recognized',\n },\n messages: {\n unknownUnit: \"Unknown unit '{{unit}}' in value '{{value}}'.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n const ctx = new TastyContext(context);\n\n function checkUnitsInValue(value: string, node: TSESTree.Node): void {\n if (ctx.config.units === false) return;\n\n // Split by spaces and check each token\n const tokens = value.split(/\\s+/);\n for (const token of tokens) {\n // Skip function calls, colors, modifiers, special values\n if (\n token.startsWith('#') ||\n token.startsWith('$') ||\n token.startsWith('@') ||\n token.includes('(') ||\n token.includes(')') ||\n token === 'true' ||\n token === 'false' ||\n token === 'none' ||\n token === 'auto' ||\n token === 'inherit' ||\n token === 'initial' ||\n token === 'unset' ||\n token === 'revert'\n ) {\n continue;\n }\n\n const unit = extractCustomUnit(token);\n if (unit && !isValidUnit(unit, ctx.config)) {\n context.report({\n node,\n messageId: 'unknownUnit',\n data: { unit, value: token },\n });\n }\n }\n }\n\n function checkNode(node: TSESTree.Node): void {\n const str = getStringValue(node);\n if (str) {\n checkUnitsInValue(str, node);\n }\n }\n\n return {\n ImportDeclaration(node) {\n ctx.trackImport(node);\n },\n\n 'CallExpression ObjectExpression Property'(node: TSESTree.Property) {\n const objExpr = node.parent as TSESTree.ObjectExpression;\n const callExpr = objExpr.parent;\n if (\n callExpr?.type !== 'CallExpression' &&\n callExpr?.type !== 'Property'\n )\n return;\n\n // Find closest object expression that is a style object\n let current: TSESTree.Node | undefined = objExpr;\n while (current) {\n if (\n current.type === 'ObjectExpression' &&\n ctx.isStyleObject(current)\n ) {\n break;\n }\n current = current.parent;\n }\n if (!current) return;\n\n // Check value\n checkNode(node.value);\n\n // Check state map values\n if (node.value.type === 'ObjectExpression') {\n for (const stateProp of node.value.properties) {\n if (stateProp.type === 'Property') {\n checkNode(stateProp.value);\n }\n }\n }\n },\n };\n },\n});\n"],"mappings":";;;;;AAOA,gCAAe,WAA2B;CACxC,MAAM;CACN,MAAM;EACJ,MAAM;EACN,MAAM,EACJ,aAAa,6DACd;EACD,UAAU,EACR,aAAa,iDACd;EACD,QAAQ,EAAE;EACX;CACD,gBAAgB,EAAE;CAClB,OAAO,SAAS;EACd,MAAM,MAAM,IAAI,aAAa,QAAQ;EAErC,SAAS,kBAAkB,OAAe,MAA2B;AACnE,OAAI,IAAI,OAAO,UAAU,MAAO;GAGhC,MAAM,SAAS,MAAM,MAAM,MAAM;AACjC,QAAK,MAAM,SAAS,QAAQ;AAE1B,QACE,MAAM,WAAW,IAAI,IACrB,MAAM,WAAW,IAAI,IACrB,MAAM,WAAW,IAAI,IACrB,MAAM,SAAS,IAAI,IACnB,MAAM,SAAS,IAAI,IACnB,UAAU,UACV,UAAU,WACV,UAAU,UACV,UAAU,UACV,UAAU,aACV,UAAU,aACV,UAAU,WACV,UAAU,SAEV;IAGF,MAAM,OAAO,kBAAkB,MAAM;AACrC,QAAI,QAAQ,CAAC,YAAY,MAAM,IAAI,OAAO,CACxC,SAAQ,OAAO;KACb;KACA,WAAW;KACX,MAAM;MAAE;MAAM,OAAO;MAAO;KAC7B,CAAC;;;EAKR,SAAS,UAAU,MAA2B;GAC5C,MAAM,MAAM,eAAe,KAAK;AAChC,OAAI,IACF,mBAAkB,KAAK,KAAK;;AAIhC,SAAO;GACL,kBAAkB,MAAM;AACtB,QAAI,YAAY,KAAK;;GAGvB,2CAA2C,MAAyB;IAClE,MAAM,UAAU,KAAK;IACrB,MAAM,WAAW,QAAQ;AACzB,QACE,UAAU,SAAS,oBACnB,UAAU,SAAS,WAEnB;IAGF,IAAI,UAAqC;AACzC,WAAO,SAAS;AACd,SACE,QAAQ,SAAS,sBACjB,IAAI,cAAc,QAAQ,CAE1B;AAEF,eAAU,QAAQ;;AAEpB,QAAI,CAAC,QAAS;AAGd,cAAU,KAAK,MAAM;AAGrB,QAAI,KAAK,MAAM,SAAS,oBACtB;UAAK,MAAM,aAAa,KAAK,MAAM,WACjC,KAAI,UAAU,SAAS,WACrB,WAAU,UAAU,MAAM;;;GAKnC;;CAEJ,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createRule } from "../create-rule.mjs";
|
|
2
|
+
import { DIRECTIONAL_MODIFIERS } from "../constants.mjs";
|
|
3
|
+
import { TastyContext } from "../context.mjs";
|
|
4
|
+
import { getKeyName, getStringValue } from "../utils.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/rules/valid-directional-modifier.ts
|
|
7
|
+
const ALL_DIRECTIONS = new Set([
|
|
8
|
+
"top",
|
|
9
|
+
"right",
|
|
10
|
+
"bottom",
|
|
11
|
+
"left",
|
|
12
|
+
"top-left",
|
|
13
|
+
"top-right",
|
|
14
|
+
"bottom-left",
|
|
15
|
+
"bottom-right"
|
|
16
|
+
]);
|
|
17
|
+
var valid_directional_modifier_default = createRule({
|
|
18
|
+
name: "valid-directional-modifier",
|
|
19
|
+
meta: {
|
|
20
|
+
type: "problem",
|
|
21
|
+
docs: { description: "Validate that directional modifiers are used only on properties that support them" },
|
|
22
|
+
messages: { invalidDirectionalModifier: "Property '{{property}}' does not support directional modifier '{{modifier}}'." },
|
|
23
|
+
schema: []
|
|
24
|
+
},
|
|
25
|
+
defaultOptions: [],
|
|
26
|
+
create(context) {
|
|
27
|
+
const ctx = new TastyContext(context);
|
|
28
|
+
function checkValue(property, value, node) {
|
|
29
|
+
const tokens = value.trim().split(/\s+/);
|
|
30
|
+
for (const token of tokens) {
|
|
31
|
+
if (!ALL_DIRECTIONS.has(token)) continue;
|
|
32
|
+
const allowedMods = DIRECTIONAL_MODIFIERS[property];
|
|
33
|
+
if (!allowedMods || !allowedMods.has(token)) context.report({
|
|
34
|
+
node,
|
|
35
|
+
messageId: "invalidDirectionalModifier",
|
|
36
|
+
data: {
|
|
37
|
+
property,
|
|
38
|
+
modifier: token
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
ImportDeclaration(node) {
|
|
45
|
+
ctx.trackImport(node);
|
|
46
|
+
},
|
|
47
|
+
"CallExpression ObjectExpression"(node) {
|
|
48
|
+
if (!ctx.isStyleObject(node)) return;
|
|
49
|
+
for (const prop of node.properties) {
|
|
50
|
+
if (prop.type !== "Property" || prop.computed) continue;
|
|
51
|
+
const key = getKeyName(prop.key);
|
|
52
|
+
if (key === null) continue;
|
|
53
|
+
const str = getStringValue(prop.value);
|
|
54
|
+
if (str) {
|
|
55
|
+
checkValue(key, str, prop.value);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (prop.value.type === "ObjectExpression") for (const stateProp of prop.value.properties) {
|
|
59
|
+
if (stateProp.type !== "Property") continue;
|
|
60
|
+
const stateStr = getStringValue(stateProp.value);
|
|
61
|
+
if (stateStr) checkValue(key, stateStr, stateProp.value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { valid_directional_modifier_default as default };
|
|
71
|
+
//# sourceMappingURL=valid-directional-modifier.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valid-directional-modifier.mjs","names":[],"sources":["../../src/rules/valid-directional-modifier.ts"],"sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { createRule } from '../create-rule.js';\nimport { TastyContext } from '../context.js';\nimport { getKeyName, getStringValue } from '../utils.js';\nimport { DIRECTIONAL_MODIFIERS } from '../constants.js';\n\ntype MessageIds = 'invalidDirectionalModifier';\n\nconst ALL_DIRECTIONS = new Set([\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'top-left',\n 'top-right',\n 'bottom-left',\n 'bottom-right',\n]);\n\nexport default createRule<[], MessageIds>({\n name: 'valid-directional-modifier',\n meta: {\n type: 'problem',\n docs: {\n description:\n 'Validate that directional modifiers are used only on properties that support them',\n },\n messages: {\n invalidDirectionalModifier:\n \"Property '{{property}}' does not support directional modifier '{{modifier}}'.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n const ctx = new TastyContext(context);\n\n function checkValue(\n property: string,\n value: string,\n node: TSESTree.Node,\n ): void {\n const tokens = value.trim().split(/\\s+/);\n\n for (const token of tokens) {\n if (!ALL_DIRECTIONS.has(token)) continue;\n\n const allowedMods = DIRECTIONAL_MODIFIERS[property];\n if (!allowedMods || !allowedMods.has(token)) {\n context.report({\n node,\n messageId: 'invalidDirectionalModifier',\n data: { property, modifier: token },\n });\n }\n }\n }\n\n return {\n ImportDeclaration(node) {\n ctx.trackImport(node);\n },\n\n 'CallExpression ObjectExpression'(node: TSESTree.ObjectExpression) {\n if (!ctx.isStyleObject(node)) return;\n\n for (const prop of node.properties) {\n if (prop.type !== 'Property' || prop.computed) continue;\n\n const key = getKeyName(prop.key);\n if (key === null) continue;\n\n // Direct value\n const str = getStringValue(prop.value);\n if (str) {\n checkValue(key, str, prop.value);\n continue;\n }\n\n // State map\n if (prop.value.type === 'ObjectExpression') {\n for (const stateProp of prop.value.properties) {\n if (stateProp.type !== 'Property') continue;\n const stateStr = getStringValue(stateProp.value);\n if (stateStr) {\n checkValue(key, stateStr, stateProp.value);\n }\n }\n }\n }\n },\n };\n },\n});\n"],"mappings":";;;;;;AAQA,MAAM,iBAAiB,IAAI,IAAI;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,yCAAe,WAA2B;CACxC,MAAM;CACN,MAAM;EACJ,MAAM;EACN,MAAM,EACJ,aACE,qFACH;EACD,UAAU,EACR,4BACE,iFACH;EACD,QAAQ,EAAE;EACX;CACD,gBAAgB,EAAE;CAClB,OAAO,SAAS;EACd,MAAM,MAAM,IAAI,aAAa,QAAQ;EAErC,SAAS,WACP,UACA,OACA,MACM;GACN,MAAM,SAAS,MAAM,MAAM,CAAC,MAAM,MAAM;AAExC,QAAK,MAAM,SAAS,QAAQ;AAC1B,QAAI,CAAC,eAAe,IAAI,MAAM,CAAE;IAEhC,MAAM,cAAc,sBAAsB;AAC1C,QAAI,CAAC,eAAe,CAAC,YAAY,IAAI,MAAM,CACzC,SAAQ,OAAO;KACb;KACA,WAAW;KACX,MAAM;MAAE;MAAU,UAAU;MAAO;KACpC,CAAC;;;AAKR,SAAO;GACL,kBAAkB,MAAM;AACtB,QAAI,YAAY,KAAK;;GAGvB,kCAAkC,MAAiC;AACjE,QAAI,CAAC,IAAI,cAAc,KAAK,CAAE;AAE9B,SAAK,MAAM,QAAQ,KAAK,YAAY;AAClC,SAAI,KAAK,SAAS,cAAc,KAAK,SAAU;KAE/C,MAAM,MAAM,WAAW,KAAK,IAAI;AAChC,SAAI,QAAQ,KAAM;KAGlB,MAAM,MAAM,eAAe,KAAK,MAAM;AACtC,SAAI,KAAK;AACP,iBAAW,KAAK,KAAK,KAAK,MAAM;AAChC;;AAIF,SAAI,KAAK,MAAM,SAAS,mBACtB,MAAK,MAAM,aAAa,KAAK,MAAM,YAAY;AAC7C,UAAI,UAAU,SAAS,WAAY;MACnC,MAAM,WAAW,eAAe,UAAU,MAAM;AAChD,UAAI,SACF,YAAW,KAAK,UAAU,UAAU,MAAM;;;;GAMrD;;CAEJ,CAAC"}
|