@bamboocss/eslint-plugin 1.12.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/dist/index.cjs ADDED
@@ -0,0 +1,2287 @@
1
+ const require_utils = require('./utils-BQiAeXE_.cjs');
2
+ let _bamboocss_shared = require("@bamboocss/shared");
3
+ let _typescript_eslint_utils = require("@typescript-eslint/utils");
4
+ let _typescript_eslint_utils_ast_utils = require("@typescript-eslint/utils/ast-utils");
5
+ let _typescript_eslint_scope_manager = require("@typescript-eslint/scope-manager");
6
+ require("@typescript-eslint/utils/ts-eslint");
7
+
8
+ //#region package.json
9
+ var name = "@bamboocss/eslint-plugin";
10
+ var version = "1.12.0";
11
+
12
+ //#endregion
13
+ //#region src/utils/nodes.ts
14
+ const isIdentifier = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.Identifier);
15
+ const isLiteral = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.Literal);
16
+ const isTemplateLiteral = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.TemplateLiteral);
17
+ const isArrayExpression = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.ArrayExpression);
18
+ const isObjectExpression = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.ObjectExpression);
19
+ const isMemberExpression = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.MemberExpression);
20
+ const isVariableDeclarator = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.VariableDeclarator);
21
+ const isVariableDeclaration = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.VariableDeclaration);
22
+ const isJSXMemberExpression = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.JSXMemberExpression);
23
+ const isJSXOpeningElement = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.JSXOpeningElement);
24
+ const isJSXExpressionContainer = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.JSXExpressionContainer);
25
+ const isJSXAttribute = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.JSXAttribute);
26
+ const isJSXIdentifier = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.JSXIdentifier);
27
+ const isCallExpression = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.CallExpression);
28
+ const isImportDeclaration = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.ImportDeclaration);
29
+ const isImportSpecifier = (0, _typescript_eslint_utils_ast_utils.isNodeOfType)(_typescript_eslint_utils.AST_NODE_TYPES.ImportSpecifier);
30
+
31
+ //#endregion
32
+ //#region src/utils/helpers.ts
33
+ const getAncestor = (ofType, for_) => {
34
+ let current = for_.parent;
35
+ while (current) {
36
+ if (ofType(current)) return current;
37
+ current = current.parent;
38
+ }
39
+ };
40
+ const getSyncOptions = (context) => {
41
+ return {
42
+ configPath: context.settings["@bamboocss/configPath"],
43
+ currentFile: context.filename
44
+ };
45
+ };
46
+ const getImportSpecifiers = (context) => {
47
+ const specifiers = [];
48
+ for (const node of context.sourceCode?.ast.body) {
49
+ if (!isImportDeclaration(node)) continue;
50
+ const module_ = node.source.value;
51
+ if (!module_) continue;
52
+ for (const specifier of node.specifiers) {
53
+ if (!isImportSpecifier(specifier)) continue;
54
+ specifiers.push({
55
+ mod: module_,
56
+ specifier
57
+ });
58
+ }
59
+ }
60
+ return specifiers;
61
+ };
62
+ const hasPkgImport = (context) => {
63
+ return _getImports(context).some(({ mod }) => mod === "@bamboocss/dev");
64
+ };
65
+ const isBambooConfigFunction = (context, name) => {
66
+ return _getImports(context).some(({ alias, mod }) => alias === name && mod === "@bamboocss/dev");
67
+ };
68
+ const rawImportsCache = /* @__PURE__ */ new WeakMap();
69
+ const _getImports = (context) => {
70
+ if (rawImportsCache.has(context)) return rawImportsCache.get(context);
71
+ const imports = getImportSpecifiers(context).map(({ mod, specifier }) => ({
72
+ alias: specifier.local.name,
73
+ mod,
74
+ name: specifier.imported.name
75
+ }));
76
+ rawImportsCache.set(context, imports);
77
+ return imports;
78
+ };
79
+ const importsCache = /* @__PURE__ */ new WeakMap();
80
+ const getImports = (context) => {
81
+ if (importsCache.has(context)) return importsCache.get(context);
82
+ const imports = _getImports(context);
83
+ const result = require_utils.syncAction("filterImports", getSyncOptions(context), imports) ?? [];
84
+ importsCache.set(context, result);
85
+ return result;
86
+ };
87
+ const isValidStyledProperty = (node, context) => {
88
+ return isJSXIdentifier(node) && isValidProperty(node.name, context);
89
+ };
90
+ const matchFile = (name, imports, context) => {
91
+ return require_utils.syncAction("matchFile", getSyncOptions(context), name, imports);
92
+ };
93
+ const isBambooIsh = (name, context) => {
94
+ const imports = getImports(context);
95
+ if (imports.length === 0) return false;
96
+ const jsxFactory = require_utils.syncAction("getJsxFactory", getSyncOptions(context));
97
+ if (jsxFactory && name === jsxFactory) return imports.some((imp) => imp.name === name || imp.alias === name);
98
+ return matchFile(name, imports, context);
99
+ };
100
+ const scopeCache = /* @__PURE__ */ new WeakMap();
101
+ const findDeclaration = (name, context) => {
102
+ try {
103
+ const source = context.sourceCode;
104
+ if (!source) {
105
+ console.warn("⚠️ ESLint's sourceCode is not available. Ensure that the rule is invoked with valid code.");
106
+ return;
107
+ }
108
+ let scope = scopeCache.get(source.ast);
109
+ if (!scope) {
110
+ scope = (0, _typescript_eslint_scope_manager.analyze)(source.ast, { sourceType: "module" });
111
+ scopeCache.set(source.ast, scope);
112
+ }
113
+ const decl = scope.variables.find((v) => v.name === name)?.defs.find((d) => isIdentifier(d.name) && d.name.name === name)?.node;
114
+ if (isVariableDeclarator(decl)) return decl;
115
+ } catch (error) {
116
+ console.error("Error in findDeclaration:", error);
117
+ return;
118
+ }
119
+ };
120
+ const isLocalStyledFactory = (node, context) => {
121
+ if (!isJSXIdentifier(node.name)) return;
122
+ const decl = findDeclaration(node.name.name, context);
123
+ if (!decl) return;
124
+ if (!isCallExpression(decl.init)) return;
125
+ if (!isIdentifier(decl.init.callee)) return;
126
+ const calleeName = decl.init.callee.name;
127
+ if (!_getImports(context).some((imp) => imp.alias === calleeName && imp.mod.includes("bamboo")) && !isBambooIsh(calleeName, context)) return;
128
+ return true;
129
+ };
130
+ const isValidFile = (context) => {
131
+ return require_utils.syncAction("isValidFile", getSyncOptions(context));
132
+ };
133
+ const isValidProperty = (name, context, calleName) => {
134
+ return require_utils.syncAction("isValidProperty", getSyncOptions(context), name, calleName);
135
+ };
136
+ const isBambooImport = (node, context) => {
137
+ return getImports(context).some((imp) => imp.mod === node.source.value);
138
+ };
139
+ const isBambooProp = (node, context) => {
140
+ const jsxAncestor = getAncestor(isJSXOpeningElement, node);
141
+ if (!jsxAncestor) return;
142
+ if (!isJSXMemberExpression(jsxAncestor.name) && !isJSXIdentifier(jsxAncestor.name)) return;
143
+ let isBambooComponent = false;
144
+ let componentName;
145
+ if (isJSXMemberExpression(jsxAncestor.name)) {
146
+ const objectName = jsxAncestor.name.object.name;
147
+ componentName = objectName;
148
+ const imports = getImports(context);
149
+ const rawImports = _getImports(context);
150
+ isBambooComponent = imports.some((imp) => imp.alias === objectName) || rawImports.some((imp) => imp.alias === objectName && imp.mod.includes("bamboo")) || isBambooIsh(objectName, context);
151
+ if (isBambooComponent) return true;
152
+ } else if (isJSXIdentifier(jsxAncestor.name)) {
153
+ componentName = jsxAncestor.name.name;
154
+ if (isLocalStyledFactory(jsxAncestor, context)) {
155
+ const property = node.name.name;
156
+ if (property === "css" || typeof property === "string" && property.startsWith("_")) return true;
157
+ if (typeof property !== "string" || !isValidProperty(property, context)) return false;
158
+ return true;
159
+ }
160
+ isBambooComponent = isBambooIsh(componentName, context);
161
+ }
162
+ if (!isBambooComponent) return;
163
+ const property = node.name.name;
164
+ if (typeof property !== "string" || !isValidProperty(property, context, componentName)) return;
165
+ return true;
166
+ };
167
+ const isStyledProperty = (node, context, calleeName) => {
168
+ if (!isIdentifier(node.key) && !isLiteral(node.key) && !isTemplateLiteral(node.key)) return;
169
+ if (isIdentifier(node.key) && !isValidProperty(node.key.name, context, calleeName)) return;
170
+ if (isLiteral(node.key) && typeof node.key.value === "string" && !isValidProperty(node.key.value, context, calleeName)) return;
171
+ if (isTemplateLiteral(node.key) && !isValidProperty(node.key.quasis[0].value.raw, context, calleeName)) return;
172
+ return true;
173
+ };
174
+ const isInBambooFunction = (node, context) => {
175
+ const callAncestor = getAncestor(isCallExpression, node);
176
+ if (!callAncestor) return;
177
+ let calleeName;
178
+ if (isIdentifier(callAncestor.callee)) calleeName = callAncestor.callee.name;
179
+ if (isMemberExpression(callAncestor.callee) && isIdentifier(callAncestor.callee.object)) calleeName = callAncestor.callee.object.name;
180
+ if (!calleeName) return;
181
+ if (!isBambooIsh(calleeName, context)) return;
182
+ return calleeName;
183
+ };
184
+ const isInJSXProp = (node, context) => {
185
+ const jsxExprAncestor = getAncestor(isJSXExpressionContainer, node);
186
+ const jsxAttributeAncestor = getAncestor(isJSXAttribute, node);
187
+ if (!jsxExprAncestor || !jsxAttributeAncestor) return;
188
+ const jsxElement = getAncestor(isJSXOpeningElement, jsxAttributeAncestor);
189
+ if (!jsxElement) return;
190
+ let isBambooComponent = false;
191
+ if (isJSXMemberExpression(jsxElement.name)) {
192
+ const objectName = jsxElement.name.object.name;
193
+ isBambooComponent = isBambooIsh(objectName, context);
194
+ } else if (isJSXIdentifier(jsxElement.name)) {
195
+ const componentName = jsxElement.name.name;
196
+ isBambooComponent = isBambooIsh(componentName, context) || Boolean(isLocalStyledFactory(jsxElement, context));
197
+ }
198
+ if (!isBambooComponent) return;
199
+ if (!isJSXIdentifier(jsxAttributeAncestor.name)) return;
200
+ if (!isValidStyledProperty(jsxAttributeAncestor.name, context)) return;
201
+ return true;
202
+ };
203
+ const isBambooAttribute = (node, context) => {
204
+ if (getAncestor(isCallExpression, node)) {
205
+ const callee = isInBambooFunction(node, context);
206
+ if (!callee) return;
207
+ return isStyledProperty(node, context, callee);
208
+ }
209
+ return isInJSXProp(node, context) && isStyledProperty(node, context);
210
+ };
211
+ const resolveLonghand = (name, context) => {
212
+ return require_utils.syncAction("resolveLongHand", getSyncOptions(context), name);
213
+ };
214
+ const resolveShorthands = (name, context) => {
215
+ return require_utils.syncAction("resolveShorthands", getSyncOptions(context), name);
216
+ };
217
+ const isColorAttribute = (attribute, context) => {
218
+ return require_utils.syncAction("isColorAttribute", getSyncOptions(context), attribute);
219
+ };
220
+ const isColorToken = (value, context) => {
221
+ if (!value) return;
222
+ return require_utils.syncAction("isColorToken", getSyncOptions(context), value);
223
+ };
224
+ const extractTokens = (value) => {
225
+ const regex = /token\(([^"'(),]+)(?:,\s*([^"'(),]+))?\)|\{([^\n\r{}]+)\}/g;
226
+ const matches = [];
227
+ let match;
228
+ while ((match = regex.exec(value)) !== null) {
229
+ const tokenFromFirstSyntax = match[1] || match[2] || match[3];
230
+ const tokensFromSecondSyntax = match[4] && match[4].match(/(\w+\.\w+(\.\w+)?)/g);
231
+ if (tokenFromFirstSyntax) matches.push(tokenFromFirstSyntax);
232
+ if (tokensFromSecondSyntax) matches.push(...tokensFromSecondSyntax);
233
+ }
234
+ return matches.filter(Boolean);
235
+ };
236
+ const invalidTokensCache = /* @__PURE__ */ new Map();
237
+ const getInvalidTokens = (value, context) => {
238
+ if (invalidTokensCache.has(value)) return invalidTokensCache.get(value);
239
+ const tokens = extractTokens(value);
240
+ if (!tokens.length) return [];
241
+ const invalidTokens = require_utils.syncAction("filterInvalidTokens", getSyncOptions(context), tokens);
242
+ invalidTokensCache.set(value, invalidTokens);
243
+ return invalidTokens;
244
+ };
245
+ const deprecatedTokensCache = /* @__PURE__ */ new Map();
246
+ const getDeprecatedTokens = (property, value, context) => {
247
+ const propertyCategory = require_utils.syncAction("getPropCategory", getSyncOptions(context), property);
248
+ const tokens = extractTokens(value);
249
+ if (!propertyCategory && !tokens.length) return [];
250
+ const values = tokens.length ? tokens : [{
251
+ category: propertyCategory,
252
+ value: value.split("/")[0]
253
+ }];
254
+ if (deprecatedTokensCache.has(value)) return deprecatedTokensCache.get(value);
255
+ const deprecatedTokens = require_utils.syncAction("filterDeprecatedTokens", getSyncOptions(context), values);
256
+ deprecatedTokensCache.set(value, deprecatedTokens);
257
+ return deprecatedTokens;
258
+ };
259
+ const getTokenImport = (context) => {
260
+ return _getImports(context).find((imp) => imp.name === "token");
261
+ };
262
+ const getTaggedTemplateCaller = (node) => {
263
+ if (isIdentifier(node.tag)) return node.tag.name;
264
+ if (isMemberExpression(node.tag)) {
265
+ if (!isIdentifier(node.tag.object)) return;
266
+ return node.tag.object.name;
267
+ }
268
+ if (isCallExpression(node.tag)) {
269
+ if (!isIdentifier(node.tag.callee)) return;
270
+ return node.tag.callee.name;
271
+ }
272
+ };
273
+ const isStyledTaggedTemplate = (node, context) => {
274
+ const caller = getTaggedTemplateCaller(node);
275
+ if (!caller) return false;
276
+ return _getImports(context).some((imp) => imp.alias === caller && imp.mod.includes("bamboo")) || isBambooIsh(caller, context);
277
+ };
278
+ function isRecipeVariant(node, context) {
279
+ const caller = isInBambooFunction(node, context);
280
+ if (!caller) return;
281
+ if (!getImports(context).find((imp) => ["cva", "sva"].includes(imp.name) && imp.alias === caller)) return;
282
+ let currentNode = node;
283
+ let length = 0;
284
+ let styleObjectParent = null;
285
+ while (currentNode) {
286
+ const keyName = currentNode?.key?.name;
287
+ if (keyName && ["base", "variants"].includes(keyName)) styleObjectParent = keyName;
288
+ currentNode = currentNode.parent;
289
+ if (!styleObjectParent) length++;
290
+ }
291
+ if (length < (caller === "cva" ? 2 : 4) + (styleObjectParent === "base" ? 0 : 4)) return true;
292
+ }
293
+
294
+ //#endregion
295
+ //#region src/rules/file-not-included.ts
296
+ const RULE_NAME$18 = "file-not-included";
297
+ const rule$18 = require_utils.createRule({
298
+ create(context) {
299
+ if (isValidFile(context)) return {};
300
+ let hasReported = false;
301
+ return { ImportDeclaration(node) {
302
+ if (hasReported) return;
303
+ if (!isBambooImport(node, context)) return;
304
+ context.report({
305
+ messageId: "include",
306
+ node
307
+ });
308
+ hasReported = true;
309
+ } };
310
+ },
311
+ defaultOptions: [],
312
+ meta: {
313
+ docs: { description: "Disallow the use of Bamboo CSS in files that are not included in the specified Bamboo CSS `include` config." },
314
+ messages: { include: "The use of Bamboo CSS is not allowed in this file. Please ensure the file is included in the Bamboo CSS `include` configuration." },
315
+ schema: [],
316
+ type: "problem"
317
+ },
318
+ name: RULE_NAME$18
319
+ });
320
+
321
+ //#endregion
322
+ //#region src/rules/no-config-function-in-source.ts
323
+ const RULE_NAME$17 = "no-config-function-in-source";
324
+ const CONFIG_FUNCTIONS = new Set([
325
+ "defineConfig",
326
+ "defineGlobalStyles",
327
+ "defineKeyframes",
328
+ "defineLayerStyles",
329
+ "defineParts",
330
+ "definePattern",
331
+ "definePreset",
332
+ "defineRecipe",
333
+ "defineSemanticTokens",
334
+ "defineSlotRecipe",
335
+ "defineStyles",
336
+ "defineTextStyles",
337
+ "defineTokens",
338
+ "defineUtility"
339
+ ]);
340
+ const rule$17 = require_utils.createRule({
341
+ create(context) {
342
+ if (!hasPkgImport(context)) return {};
343
+ if (!isValidFile(context)) return {};
344
+ return { CallExpression(node) {
345
+ if (!isIdentifier(node.callee)) return;
346
+ const functionName = node.callee.name;
347
+ if (!CONFIG_FUNCTIONS.has(functionName)) return;
348
+ if (!isBambooConfigFunction(context, functionName)) return;
349
+ context.report({
350
+ data: { name: functionName },
351
+ messageId: "configFunction",
352
+ node,
353
+ suggest: [{
354
+ data: { name: functionName },
355
+ fix(fixer) {
356
+ const declaration = getAncestor(isVariableDeclaration, node);
357
+ const importSpec = getImportSpecifiers(context).find((s) => s.specifier.local.name === functionName);
358
+ const fixes = [];
359
+ if (declaration) fixes.push(fixer.remove(declaration));
360
+ else fixes.push(fixer.remove(node));
361
+ if (importSpec?.specifier) fixes.push(fixer.remove(importSpec.specifier));
362
+ return fixes;
363
+ },
364
+ messageId: "delete"
365
+ }]
366
+ });
367
+ } };
368
+ },
369
+ defaultOptions: [],
370
+ meta: {
371
+ docs: { description: "Prohibit the use of config functions outside the Bamboo config file." },
372
+ hasSuggestions: true,
373
+ messages: {
374
+ configFunction: "Unnecessary `{{name}}` call. Config functions should only be used in the Bamboo config file.",
375
+ delete: "Delete `{{name}}` call."
376
+ },
377
+ schema: [],
378
+ type: "problem"
379
+ },
380
+ name: RULE_NAME$17
381
+ });
382
+
383
+ //#endregion
384
+ //#region src/rules/no-debug.ts
385
+ const RULE_NAME$16 = "no-debug";
386
+ const rule$16 = require_utils.createRule({
387
+ create(context) {
388
+ const processedNodes = /* @__PURE__ */ new WeakSet();
389
+ const checkObjectForDebug = (object) => {
390
+ for (const property of object.properties) {
391
+ if (property.type !== "Property") continue;
392
+ if (!property.key || property.key.type !== "Identifier") continue;
393
+ if (property.key.name === "debug") {
394
+ if (processedNodes.has(property)) continue;
395
+ processedNodes.add(property);
396
+ context.report({
397
+ messageId: "debug",
398
+ node: property.key,
399
+ suggest: [{
400
+ fix: (fixer) => fixer.removeRange([property.range[0], property.range[1] + 1]),
401
+ messageId: "property"
402
+ }]
403
+ });
404
+ }
405
+ if (property.value && property.value.type === "ObjectExpression") checkObjectForDebug(property.value);
406
+ }
407
+ };
408
+ return {
409
+ JSXAttribute(node) {
410
+ if (!isBambooProp(node, context)) return;
411
+ if (!node.value || !isJSXExpressionContainer(node.value)) return;
412
+ const expr = node.value.expression;
413
+ if (!isObjectExpression(expr)) return;
414
+ checkObjectForDebug(expr);
415
+ },
416
+ "JSXAttribute[name.name=\"debug\"]"(node) {
417
+ if (!isBambooProp(node, context)) return;
418
+ context.report({
419
+ messageId: "debug",
420
+ node,
421
+ suggest: [{
422
+ fix: (fixer) => fixer.remove(node),
423
+ messageId: "prop"
424
+ }]
425
+ });
426
+ },
427
+ "Property[key.name=\"debug\"]"(node) {
428
+ if (processedNodes.has(node)) return;
429
+ if (!isBambooAttribute(node, context)) return;
430
+ if (isRecipeVariant(node, context)) return;
431
+ processedNodes.add(node);
432
+ context.report({
433
+ messageId: "debug",
434
+ node: node.key,
435
+ suggest: [{
436
+ fix: (fixer) => fixer.removeRange([node.range[0], node.range[1] + 1]),
437
+ messageId: "property"
438
+ }]
439
+ });
440
+ }
441
+ };
442
+ },
443
+ defaultOptions: [],
444
+ meta: {
445
+ docs: { description: "Disallow the inclusion of the debug attribute when shipping code to the production environment." },
446
+ hasSuggestions: true,
447
+ messages: {
448
+ debug: "Unnecessary debug utility.",
449
+ prop: "Remove the debug prop.",
450
+ property: "Remove the debug property."
451
+ },
452
+ schema: [],
453
+ type: "problem"
454
+ },
455
+ name: RULE_NAME$16
456
+ });
457
+
458
+ //#endregion
459
+ //#region src/rules/no-deprecated-tokens.ts
460
+ const RULE_NAME$15 = "no-deprecated-tokens";
461
+ const rule$15 = require_utils.createRule({
462
+ create(context) {
463
+ const deprecatedTokensCache = /* @__PURE__ */ new Map();
464
+ const sendReport = (property, node, value) => {
465
+ if (!value) return;
466
+ let tokens = deprecatedTokensCache.get(value);
467
+ if (!tokens) {
468
+ tokens = getDeprecatedTokens(property, value, context);
469
+ deprecatedTokensCache.set(value, tokens);
470
+ }
471
+ if (!tokens || tokens.length === 0) return;
472
+ for (const token of tokens) context.report({
473
+ data: {
474
+ category: typeof token === "string" ? void 0 : token.category,
475
+ token: typeof token === "string" ? token : token.value
476
+ },
477
+ messageId: typeof token === "string" ? "noDeprecatedTokenPaths" : "noDeprecatedTokens",
478
+ node
479
+ });
480
+ };
481
+ const handleLiteralOrTemplate = (property, node) => {
482
+ if (!node) return;
483
+ if (isLiteral(node)) {
484
+ const value = node.value?.toString();
485
+ sendReport(property, node, value);
486
+ } else if (isTemplateLiteral(node) && node.expressions.length === 0) {
487
+ const value = node.quasis[0].value.raw;
488
+ sendReport(property, node.quasis[0], value);
489
+ }
490
+ };
491
+ return {
492
+ JSXAttribute(node) {
493
+ if (!node.value || !isBambooProp(node, context)) return;
494
+ const property = node.name.name;
495
+ if (isLiteral(node.value)) handleLiteralOrTemplate(property, node.value);
496
+ else if (isJSXExpressionContainer(node.value)) handleLiteralOrTemplate(property, node.value.expression);
497
+ },
498
+ Property(node) {
499
+ if (!isIdentifier(node.key) || !(0, _typescript_eslint_utils_ast_utils.isNodeOfTypes)([_typescript_eslint_utils.AST_NODE_TYPES.Literal, _typescript_eslint_utils.AST_NODE_TYPES.TemplateLiteral])(node.value) || !isBambooAttribute(node, context) || isRecipeVariant(node, context)) return;
500
+ const property = node.key.name;
501
+ handleLiteralOrTemplate(property, node.value);
502
+ }
503
+ };
504
+ },
505
+ defaultOptions: [],
506
+ meta: {
507
+ docs: { description: "Disallow the use of deprecated tokens within token function syntax." },
508
+ messages: {
509
+ noDeprecatedTokenPaths: "`{{token}}` is a deprecated token.",
510
+ noDeprecatedTokens: "`{{token}}` is a deprecated {{category}} token."
511
+ },
512
+ schema: [],
513
+ type: "problem"
514
+ },
515
+ name: RULE_NAME$15
516
+ });
517
+
518
+ //#endregion
519
+ //#region src/rules/no-dynamic-styling.ts
520
+ const RULE_NAME$14 = "no-dynamic-styling";
521
+ const rule$14 = require_utils.createRule({
522
+ create(context) {
523
+ function isStaticValue(node) {
524
+ if (!node) return false;
525
+ if (isLiteral(node)) return true;
526
+ if (isTemplateLiteral(node) && node.expressions.length === 0) return true;
527
+ if (isObjectExpression(node)) return true;
528
+ return false;
529
+ }
530
+ function checkArrayElements(array) {
531
+ for (const element of array.elements) {
532
+ if (!element) continue;
533
+ if (isStaticValue(element)) continue;
534
+ context.report({
535
+ messageId: "dynamic",
536
+ node: element
537
+ });
538
+ }
539
+ }
540
+ return {
541
+ JSXAttribute(node) {
542
+ if (!node.value) return;
543
+ if (!isBambooProp(node, context)) return;
544
+ if (isLiteral(node.value)) return;
545
+ if (isJSXExpressionContainer(node.value)) {
546
+ const expr = node.value.expression;
547
+ if (isStaticValue(expr)) return;
548
+ if (isArrayExpression(expr)) {
549
+ checkArrayElements(expr);
550
+ return;
551
+ }
552
+ context.report({
553
+ messageId: "dynamic",
554
+ node: node.value
555
+ });
556
+ }
557
+ },
558
+ Property(node) {
559
+ if (!isIdentifier(node.key)) return;
560
+ if (!isBambooAttribute(node, context)) return;
561
+ if (isRecipeVariant(node, context)) return;
562
+ if (isStaticValue(node.value)) return;
563
+ if (isArrayExpression(node.value)) {
564
+ checkArrayElements(node.value);
565
+ return;
566
+ }
567
+ context.report({
568
+ messageId: "dynamic",
569
+ node: node.value
570
+ });
571
+ },
572
+ "Property[computed=true]": (node) => {
573
+ if (!isInBambooFunction(node, context)) return;
574
+ context.report({
575
+ messageId: isRecipeVariant(node, context) ? "dynamicRecipeVariant" : "dynamicProperty",
576
+ node: node.key
577
+ });
578
+ }
579
+ };
580
+ },
581
+ defaultOptions: [],
582
+ meta: {
583
+ docs: { description: "Ensure users don't use dynamic styling. Prefer static styles, leverage CSS variables, or recipes for known dynamic styles." },
584
+ messages: {
585
+ dynamic: "Remove dynamic value. Prefer static styles.",
586
+ dynamicProperty: "Remove dynamic property. Prefer static style property.",
587
+ dynamicRecipeVariant: "Remove dynamic variant. Prefer static variant definition."
588
+ },
589
+ schema: [],
590
+ type: "problem"
591
+ },
592
+ name: RULE_NAME$14
593
+ });
594
+
595
+ //#endregion
596
+ //#region src/rules/no-escape-hatch.ts
597
+ const RULE_NAME$13 = "no-escape-hatch";
598
+ const rule$13 = require_utils.createRule({
599
+ create(context) {
600
+ const removeBrackets = (range) => {
601
+ const [start, end] = range;
602
+ return [start + 1, end - 1];
603
+ };
604
+ const hasEscapeHatch = (value) => {
605
+ if (!value) return false;
606
+ if (!value.includes("[")) return false;
607
+ return (0, _bamboocss_shared.getArbitraryValue)(value) !== value.trim();
608
+ };
609
+ const handleNodeValue = (node, value) => {
610
+ if (!hasEscapeHatch(value)) return;
611
+ context.report({
612
+ messageId: "escapeHatch",
613
+ node,
614
+ suggest: [{
615
+ fix: (fixer) => {
616
+ return fixer.replaceTextRange(removeBrackets(node.range), (0, _bamboocss_shared.getArbitraryValue)(value));
617
+ },
618
+ messageId: "remove"
619
+ }]
620
+ });
621
+ };
622
+ return {
623
+ JSXAttribute(node) {
624
+ if (!node.value) return;
625
+ if (!isBambooProp(node, context)) return;
626
+ const { value } = node;
627
+ if (isLiteral(value)) handleNodeValue(value, value.value?.toString() ?? "");
628
+ else if (isJSXExpressionContainer(value)) {
629
+ const expr = value.expression;
630
+ if (isLiteral(expr)) handleNodeValue(expr, expr.value?.toString() ?? "");
631
+ else if (isTemplateLiteral(expr) && expr.expressions.length === 0) {
632
+ const value_ = expr.quasis[0].value.raw;
633
+ handleNodeValue(expr.quasis[0], value_);
634
+ }
635
+ }
636
+ },
637
+ Property(node) {
638
+ if (!isIdentifier(node.key)) return;
639
+ if (!isBambooAttribute(node, context)) return;
640
+ if (isRecipeVariant(node, context)) return;
641
+ const value = node.value;
642
+ if (isLiteral(value)) handleNodeValue(value, value.value?.toString() ?? "");
643
+ else if (isTemplateLiteral(value) && value.expressions.length === 0) {
644
+ const value_ = value.quasis[0].value.raw;
645
+ handleNodeValue(value.quasis[0], value_);
646
+ }
647
+ }
648
+ };
649
+ },
650
+ defaultOptions: [],
651
+ meta: {
652
+ docs: { description: "Prohibit the use of escape hatch syntax in the code." },
653
+ hasSuggestions: true,
654
+ messages: {
655
+ escapeHatch: "Avoid using the escape hatch [value] for undefined tokens. Define a corresponding token in your design system for better consistency and maintainability.",
656
+ remove: "Remove the square brackets (`[]`)."
657
+ },
658
+ schema: [],
659
+ type: "problem"
660
+ },
661
+ name: RULE_NAME$13
662
+ });
663
+
664
+ //#endregion
665
+ //#region src/rules/no-hardcoded-color.ts
666
+ const RULE_NAME$12 = "no-hardcoded-color";
667
+ const rule$12 = require_utils.createRule({
668
+ create(context) {
669
+ const noOpacity = context.options[0]?.noOpacity;
670
+ const whitelist = context.options[0]?.whitelist ?? [];
671
+ const colorTokenCache = new Map(whitelist?.map((item) => [item, true]));
672
+ const colorAttributeCache = /* @__PURE__ */ new Map();
673
+ const isColorToken$1 = (token) => {
674
+ if (colorTokenCache.has(token)) return colorTokenCache.get(token);
675
+ const result = isColorToken(token, context);
676
+ colorTokenCache.set(token, result);
677
+ return Boolean(result);
678
+ };
679
+ const isColorAttribute$1 = (attribute) => {
680
+ if (colorAttributeCache.has(attribute)) return colorAttributeCache.get(attribute);
681
+ const result = isColorAttribute(attribute, context);
682
+ colorAttributeCache.set(attribute, result);
683
+ return result;
684
+ };
685
+ const isTokenFunctionUsed = (value) => {
686
+ if (!value) return false;
687
+ return extractTokens(value).length > 0;
688
+ };
689
+ const isValidColorToken = (value) => {
690
+ if (!value) return false;
691
+ const [colorToken, opacity] = value.split("/");
692
+ const hasOpacity = opacity !== void 0 && opacity.length > 0;
693
+ const isValidToken = isColorToken$1(colorToken);
694
+ return noOpacity ? isValidToken && !hasOpacity : isValidToken;
695
+ };
696
+ const reportInvalidColor = (node, color) => {
697
+ context.report({
698
+ data: { color },
699
+ messageId: "invalidColor",
700
+ node
701
+ });
702
+ };
703
+ const checkColorValue = (node, value, attributeName) => {
704
+ if (!isColorAttribute$1(attributeName)) return;
705
+ if (isTokenFunctionUsed(value)) return;
706
+ if (isValidColorToken(value)) return;
707
+ reportInvalidColor(node, value);
708
+ };
709
+ return {
710
+ JSXAttribute(node) {
711
+ if (!isJSXIdentifier(node.name)) return;
712
+ if (!isBambooProp(node, context) || !node.value) return;
713
+ const attributeName = node.name.name;
714
+ const valueNode = node.value;
715
+ if (isLiteral(valueNode)) checkColorValue(valueNode, valueNode.value?.toString() || "", attributeName);
716
+ else if (isJSXExpressionContainer(valueNode)) {
717
+ const expression = valueNode.expression;
718
+ if (isLiteral(expression)) checkColorValue(expression, expression.value?.toString() || "", attributeName);
719
+ else if (isTemplateLiteral(expression) && expression.expressions.length === 0) {
720
+ const value = expression.quasis[0].value.raw;
721
+ checkColorValue(expression.quasis[0], value, attributeName);
722
+ }
723
+ }
724
+ },
725
+ Property(node) {
726
+ if (!isIdentifier(node.key)) return;
727
+ if (!isBambooAttribute(node, context)) return;
728
+ if (isRecipeVariant(node, context)) return;
729
+ const attributeName = node.key.name;
730
+ const valueNode = node.value;
731
+ if (isLiteral(valueNode)) checkColorValue(valueNode, valueNode.value?.toString() || "", attributeName);
732
+ else if (isTemplateLiteral(valueNode) && valueNode.expressions.length === 0) {
733
+ const value = valueNode.quasis[0].value.raw;
734
+ checkColorValue(valueNode.quasis[0], value, attributeName);
735
+ }
736
+ }
737
+ };
738
+ },
739
+ defaultOptions: [{
740
+ noOpacity: false,
741
+ whitelist: []
742
+ }],
743
+ meta: {
744
+ docs: { description: "Enforce the exclusive use of design tokens as values for colors within the codebase." },
745
+ messages: { invalidColor: "`{{color}}` is not a valid color token." },
746
+ schema: [{
747
+ additionalProperties: false,
748
+ properties: {
749
+ noOpacity: { type: "boolean" },
750
+ whitelist: {
751
+ items: {
752
+ minLength: 0,
753
+ type: "string"
754
+ },
755
+ type: "array",
756
+ uniqueItems: true
757
+ }
758
+ },
759
+ type: "object"
760
+ }],
761
+ type: "problem"
762
+ },
763
+ name: RULE_NAME$12
764
+ });
765
+
766
+ //#endregion
767
+ //#region src/rules/no-important.ts
768
+ const exclamationRegex = /\s*!$/;
769
+ const importantRegex = /\s*!important\s*$/;
770
+ const RULE_NAME$11 = "no-important";
771
+ const rule$11 = require_utils.createRule({
772
+ create(context) {
773
+ const removeQuotes = (range) => {
774
+ const [start, end] = range;
775
+ return [start + 1, end - 1];
776
+ };
777
+ const bambooPropertyCache = /* @__PURE__ */ new WeakMap();
778
+ const bambooAttributeCache = /* @__PURE__ */ new WeakMap();
779
+ const recipeVariantCache = /* @__PURE__ */ new WeakMap();
780
+ const isCachedBambooProperty = (node) => {
781
+ if (bambooPropertyCache.has(node)) return bambooPropertyCache.get(node);
782
+ const result = isBambooProp(node, context);
783
+ bambooPropertyCache.set(node, result);
784
+ return Boolean(result);
785
+ };
786
+ const isCachedBambooAttribute = (node) => {
787
+ if (bambooAttributeCache.has(node)) return bambooAttributeCache.get(node);
788
+ const result = isBambooAttribute(node, context);
789
+ bambooAttributeCache.set(node, result);
790
+ return Boolean(result);
791
+ };
792
+ const isCachedRecipeVariant = (node) => {
793
+ if (recipeVariantCache.has(node)) return recipeVariantCache.get(node);
794
+ const result = isRecipeVariant(node, context);
795
+ recipeVariantCache.set(node, result);
796
+ return Boolean(result);
797
+ };
798
+ const hasImportantKeyword = (value) => {
799
+ if (!value) return false;
800
+ const arbitraryValue = (0, _bamboocss_shared.getArbitraryValue)(value);
801
+ return exclamationRegex.test(arbitraryValue) || importantRegex.test(arbitraryValue);
802
+ };
803
+ const removeImportantKeyword = (input) => {
804
+ if (importantRegex.test(input)) return {
805
+ fixed: input.replace(importantRegex, "").trimEnd(),
806
+ keyword: "!important"
807
+ };
808
+ else if (exclamationRegex.test(input)) return {
809
+ fixed: input.replace(exclamationRegex, "").trimEnd(),
810
+ keyword: "!"
811
+ };
812
+ else return {
813
+ fixed: input,
814
+ keyword: null
815
+ };
816
+ };
817
+ const handleNodeValue = (node, value) => {
818
+ if (!hasImportantKeyword(value)) return;
819
+ const { fixed: fixedArbitrary, keyword } = removeImportantKeyword((0, _bamboocss_shared.getArbitraryValue)(value));
820
+ let fixed = value;
821
+ if (value.startsWith("[") && value.endsWith("]")) fixed = `[${fixedArbitrary}]`;
822
+ else fixed = fixedArbitrary;
823
+ context.report({
824
+ data: { keyword },
825
+ messageId: "important",
826
+ node,
827
+ suggest: [{
828
+ data: { keyword },
829
+ fix: (fixer) => {
830
+ return fixer.replaceTextRange(removeQuotes(node.range), fixed);
831
+ },
832
+ messageId: "remove"
833
+ }]
834
+ });
835
+ };
836
+ return {
837
+ JSXAttribute(node) {
838
+ if (!node.value) return;
839
+ if (!isCachedBambooProperty(node)) return;
840
+ const valueNode = node.value;
841
+ if (isLiteral(valueNode)) handleNodeValue(valueNode, valueNode.value?.toString() ?? "");
842
+ else if (isJSXExpressionContainer(valueNode)) {
843
+ const expr = valueNode.expression;
844
+ if (isLiteral(expr)) handleNodeValue(expr, expr.value?.toString() ?? "");
845
+ else if (isTemplateLiteral(expr) && expr.expressions.length === 0) {
846
+ const value = expr.quasis[0].value.raw;
847
+ handleNodeValue(expr.quasis[0], value);
848
+ }
849
+ }
850
+ },
851
+ Property(node) {
852
+ if (!isIdentifier(node.key)) return;
853
+ if (!isCachedBambooAttribute(node)) return;
854
+ if (isCachedRecipeVariant(node)) return;
855
+ const valueNode = node.value;
856
+ if (isLiteral(valueNode)) handleNodeValue(valueNode, valueNode.value?.toString() ?? "");
857
+ else if (isTemplateLiteral(valueNode) && valueNode.expressions.length === 0) {
858
+ const value = valueNode.quasis[0].value.raw;
859
+ handleNodeValue(valueNode.quasis[0], value);
860
+ }
861
+ }
862
+ };
863
+ },
864
+ defaultOptions: [],
865
+ meta: {
866
+ docs: { description: "Disallow usage of !important keyword. Prioritize specificity for a maintainable and predictable styling structure." },
867
+ hasSuggestions: true,
868
+ messages: {
869
+ important: "Avoid using the {{keyword}} keyword. Refactor your code to prioritize specificity for predictable styling.",
870
+ remove: "Remove the `{{keyword}}` keyword."
871
+ },
872
+ schema: [],
873
+ type: "problem"
874
+ },
875
+ name: RULE_NAME$11
876
+ });
877
+
878
+ //#endregion
879
+ //#region src/rules/no-invalid-nesting.ts
880
+ const RULE_NAME$10 = "no-invalid-nesting";
881
+ const rule$10 = require_utils.createRule({
882
+ create(context) {
883
+ const bambooFunctionCache = /* @__PURE__ */ new WeakMap();
884
+ const jsxPropertyCache = /* @__PURE__ */ new WeakMap();
885
+ const recipeVariantCache = /* @__PURE__ */ new WeakMap();
886
+ const styledPropertyCache = /* @__PURE__ */ new WeakMap();
887
+ const isCachedInBambooFunction = (node) => {
888
+ if (bambooFunctionCache.has(node)) return bambooFunctionCache.get(node);
889
+ const result = Boolean(isInBambooFunction(node, context));
890
+ bambooFunctionCache.set(node, result);
891
+ return Boolean(result);
892
+ };
893
+ const isCachedInJSXProperty = (node) => {
894
+ if (jsxPropertyCache.has(node)) return jsxPropertyCache.get(node);
895
+ const result = isInJSXProp(node, context);
896
+ jsxPropertyCache.set(node, result);
897
+ return Boolean(result);
898
+ };
899
+ const isCachedRecipeVariant = (node) => {
900
+ if (recipeVariantCache.has(node)) return recipeVariantCache.get(node);
901
+ const result = isRecipeVariant(node, context);
902
+ recipeVariantCache.set(node, result);
903
+ return Boolean(result);
904
+ };
905
+ const isCachedStyledProperty = (node) => {
906
+ if (styledPropertyCache.has(node)) return styledPropertyCache.get(node);
907
+ const result = isStyledProperty(node, context);
908
+ styledPropertyCache.set(node, result);
909
+ return Boolean(result);
910
+ };
911
+ const isInvalidNestingSelector = (node) => {
912
+ if (isLiteral(node) && typeof node.value === "string") return !node.value.includes("&");
913
+ else if (isTemplateLiteral(node) && node.expressions.length === 0) return !node.quasis[0].value.raw.includes("&");
914
+ return false;
915
+ };
916
+ return { "Property[key.type!=/Identifier/][value.type=\"ObjectExpression\"]"(node) {
917
+ const inBambooFunction = isCachedInBambooFunction(node);
918
+ const inJSXProperty = isCachedInJSXProperty(node);
919
+ if (!inBambooFunction && !inJSXProperty) return;
920
+ if (isCachedRecipeVariant(node)) return;
921
+ if (isCachedStyledProperty(node)) return;
922
+ const keyNode = node.key;
923
+ if (isInvalidNestingSelector(keyNode)) context.report({
924
+ messageId: "nesting",
925
+ node: keyNode
926
+ });
927
+ } };
928
+ },
929
+ defaultOptions: [],
930
+ meta: {
931
+ docs: { description: "Warn against invalid nesting. Nested styles must contain the `&` character." },
932
+ messages: { nesting: "Invalid style nesting. Nested styles must contain the `&` character." },
933
+ schema: [],
934
+ type: "problem"
935
+ },
936
+ name: RULE_NAME$10
937
+ });
938
+
939
+ //#endregion
940
+ //#region src/rules/no-invalid-token-paths.ts
941
+ const RULE_NAME$9 = "no-invalid-token-paths";
942
+ const rule$9 = require_utils.createRule({
943
+ create(context) {
944
+ const invalidTokensCache = /* @__PURE__ */ new Map();
945
+ const sendReport = (node, value) => {
946
+ if (!value) return;
947
+ let tokens = invalidTokensCache.get(value);
948
+ if (!tokens) {
949
+ tokens = getInvalidTokens(value, context);
950
+ invalidTokensCache.set(value, tokens);
951
+ }
952
+ if (!tokens || tokens.length === 0) return;
953
+ for (const token of tokens) context.report({
954
+ data: { token },
955
+ messageId: "noInvalidTokenPaths",
956
+ node
957
+ });
958
+ };
959
+ const handleLiteralOrTemplate = (node) => {
960
+ if (!node) return;
961
+ if (isLiteral(node)) {
962
+ const value = node.value?.toString();
963
+ sendReport(node, value);
964
+ } else if (isTemplateLiteral(node) && node.expressions.length === 0) {
965
+ const value = node.quasis[0].value.raw;
966
+ sendReport(node.quasis[0], value);
967
+ }
968
+ };
969
+ return {
970
+ JSXAttribute(node) {
971
+ if (!node.value || !isBambooProp(node, context)) return;
972
+ if (isLiteral(node.value)) handleLiteralOrTemplate(node.value);
973
+ else if (isJSXExpressionContainer(node.value)) handleLiteralOrTemplate(node.value.expression);
974
+ },
975
+ Property(node) {
976
+ if (!isIdentifier(node.key) || !(0, _typescript_eslint_utils_ast_utils.isNodeOfTypes)([_typescript_eslint_utils.AST_NODE_TYPES.Literal, _typescript_eslint_utils.AST_NODE_TYPES.TemplateLiteral])(node.value) || !isBambooAttribute(node, context) || isRecipeVariant(node, context)) return;
977
+ handleLiteralOrTemplate(node.value);
978
+ },
979
+ TaggedTemplateExpression(node) {
980
+ if (!getTaggedTemplateCaller(node)) return;
981
+ if (!isStyledTaggedTemplate(node, context)) return;
982
+ const quasis = node.quasi.quasis;
983
+ for (const quasi of quasis) {
984
+ const styles = quasi.value.raw;
985
+ if (!styles) continue;
986
+ let tokens = invalidTokensCache.get(styles);
987
+ if (!tokens) {
988
+ tokens = getInvalidTokens(styles, context);
989
+ invalidTokensCache.set(styles, tokens);
990
+ }
991
+ if (!tokens || tokens.length === 0) continue;
992
+ for (const token of tokens) {
993
+ let index = styles.indexOf(token);
994
+ while (index !== -1) {
995
+ const start = quasi.range[0] + index + 1;
996
+ const end = start + token.length;
997
+ context.report({
998
+ data: { token },
999
+ loc: {
1000
+ end: context.sourceCode.getLocFromIndex(end),
1001
+ start: context.sourceCode.getLocFromIndex(start)
1002
+ },
1003
+ messageId: "noInvalidTokenPaths"
1004
+ });
1005
+ index = styles.indexOf(token, index + token.length);
1006
+ }
1007
+ }
1008
+ }
1009
+ }
1010
+ };
1011
+ },
1012
+ defaultOptions: [],
1013
+ meta: {
1014
+ docs: { description: "Disallow the use of invalid token paths within token function syntax." },
1015
+ messages: { noInvalidTokenPaths: "`{{token}}` is an invalid token path." },
1016
+ schema: [],
1017
+ type: "problem"
1018
+ },
1019
+ name: RULE_NAME$9
1020
+ });
1021
+
1022
+ //#endregion
1023
+ //#region src/rules/no-margin-properties.ts
1024
+ const RULE_NAME$8 = "no-margin-properties";
1025
+ const rule$8 = require_utils.createRule({
1026
+ create(context) {
1027
+ const whitelist = context.options[0]?.whitelist ?? [];
1028
+ const longhandCache = /* @__PURE__ */ new Map();
1029
+ const getLonghand = (name) => {
1030
+ if (longhandCache.has(name)) return longhandCache.get(name);
1031
+ const longhand = resolveLonghand(name, context) ?? name;
1032
+ longhandCache.set(name, longhand);
1033
+ return longhand;
1034
+ };
1035
+ const marginRegex = /margin/i;
1036
+ const isMarginProperty = (name) => {
1037
+ const longhand = getLonghand(name).toLowerCase();
1038
+ return marginRegex.test(longhand);
1039
+ };
1040
+ const sendReport = (node) => {
1041
+ if (whitelist.includes(node.name)) return;
1042
+ if (!isMarginProperty(node.name)) return;
1043
+ context.report({
1044
+ messageId: "noMargin",
1045
+ node
1046
+ });
1047
+ };
1048
+ const bambooPropertyCache = /* @__PURE__ */ new WeakMap();
1049
+ const isCachedBambooProperty = (node) => {
1050
+ if (bambooPropertyCache.has(node)) return bambooPropertyCache.get(node);
1051
+ const result = isBambooProp(node, context);
1052
+ bambooPropertyCache.set(node, result);
1053
+ return Boolean(result);
1054
+ };
1055
+ const bambooAttributeCache = /* @__PURE__ */ new WeakMap();
1056
+ const isCachedBambooAttribute = (node) => {
1057
+ if (bambooAttributeCache.has(node)) return bambooAttributeCache.get(node);
1058
+ const result = isBambooAttribute(node, context);
1059
+ bambooAttributeCache.set(node, result);
1060
+ return Boolean(result);
1061
+ };
1062
+ const recipeVariantCache = /* @__PURE__ */ new WeakMap();
1063
+ const isCachedRecipeVariant = (node) => {
1064
+ if (recipeVariantCache.has(node)) return recipeVariantCache.get(node);
1065
+ const result = isRecipeVariant(node, context);
1066
+ recipeVariantCache.set(node, result);
1067
+ return Boolean(result);
1068
+ };
1069
+ return {
1070
+ JSXAttribute(node) {
1071
+ if (!isJSXIdentifier(node.name)) return;
1072
+ if (!isCachedBambooProperty(node)) return;
1073
+ sendReport(node.name);
1074
+ },
1075
+ Property(node) {
1076
+ if (!isIdentifier(node.key)) return;
1077
+ if (!isCachedBambooAttribute(node)) return;
1078
+ if (isCachedRecipeVariant(node)) return;
1079
+ sendReport(node.key);
1080
+ }
1081
+ };
1082
+ },
1083
+ defaultOptions: [{ whitelist: [] }],
1084
+ meta: {
1085
+ docs: { description: "Discourage using margin properties for spacing; prefer defining spacing in parent elements with `flex` or `grid` using the `gap` property for a more resilient layout. Margins make components less reusable in other contexts." },
1086
+ messages: { noMargin: "Use flex or grid with the `gap` property to define spacing in parent elements for a more resilient layout." },
1087
+ schema: [{
1088
+ additionalProperties: false,
1089
+ properties: { whitelist: {
1090
+ items: {
1091
+ minLength: 0,
1092
+ type: "string"
1093
+ },
1094
+ type: "array",
1095
+ uniqueItems: true
1096
+ } },
1097
+ type: "object"
1098
+ }],
1099
+ type: "suggestion"
1100
+ },
1101
+ name: RULE_NAME$8
1102
+ });
1103
+
1104
+ //#endregion
1105
+ //#region src/utils/physical-properties.ts
1106
+ const physicalProperties = {
1107
+ borderBottom: "borderBlockEnd",
1108
+ borderBottomColor: "borderBlockEndColor",
1109
+ borderBottomLeftRadius: "borderEndStartRadius",
1110
+ borderBottomRightRadius: "borderEndEndRadius",
1111
+ borderBottomStyle: "borderBlockEndStyle",
1112
+ borderBottomWidth: "borderBlockEndWidth",
1113
+ borderLeft: "borderInlineStart",
1114
+ borderLeftColor: "borderInlineStartColor",
1115
+ borderLeftStyle: "borderInlineStartStyle",
1116
+ borderLeftWidth: "borderInlineStartWidth",
1117
+ borderRight: "borderInlineEnd",
1118
+ borderRightColor: "borderInlineEndColor",
1119
+ borderRightStyle: "borderInlineEndStyle",
1120
+ borderRightWidth: "borderInlineEndWidth",
1121
+ borderTop: "borderBlockStart",
1122
+ borderTopColor: "borderBlockStartColor",
1123
+ borderTopLeftRadius: "borderStartStartRadius",
1124
+ borderTopRightRadius: "borderStartEndRadius",
1125
+ borderTopStyle: "borderBlockStartStyle",
1126
+ borderTopWidth: "borderBlockStartWidth",
1127
+ bottom: "insetBlockEnd",
1128
+ left: "insetInlineStart",
1129
+ marginBottom: "marginBlockEnd",
1130
+ marginLeft: "marginInlineStart",
1131
+ marginRight: "marginInlineEnd",
1132
+ marginTop: "marginBlockStart",
1133
+ paddingBottom: "paddingBlockEnd",
1134
+ paddingLeft: "paddingInlineStart",
1135
+ paddingRight: "paddingInlineEnd",
1136
+ paddingTop: "paddingBlockStart",
1137
+ right: "insetInlineEnd",
1138
+ top: "insetBlockStart"
1139
+ };
1140
+ const physicalPropertyValues = { textAlign: {
1141
+ left: "start",
1142
+ right: "end"
1143
+ } };
1144
+
1145
+ //#endregion
1146
+ //#region src/rules/no-physical-properties.ts
1147
+ const RULE_NAME$7 = "no-physical-properties";
1148
+ const MESSAGES = {
1149
+ physical: "Use logical property instead of {{physical}}. Prefer `{{logical}}`.",
1150
+ physicalValue: "Use logical value instead of {{physical}}. Prefer `{{logical}}`.",
1151
+ replace: "Replace `{{physical}}` with `{{logical}}`."
1152
+ };
1153
+ var PropertyCache = class {
1154
+ longhandCache = /* @__PURE__ */ new Map();
1155
+ bambooAttributeCache = /* @__PURE__ */ new WeakMap();
1156
+ bambooPropCache = /* @__PURE__ */ new WeakMap();
1157
+ recipeVariantCache = /* @__PURE__ */ new WeakMap();
1158
+ getLonghand(name, context) {
1159
+ if (this.longhandCache.has(name)) return this.longhandCache.get(name);
1160
+ const longhand = resolveLonghand(name, context) ?? name;
1161
+ this.longhandCache.set(name, longhand);
1162
+ return longhand;
1163
+ }
1164
+ isBambooAttribute(node, context) {
1165
+ if (this.bambooAttributeCache.has(node)) return this.bambooAttributeCache.get(node);
1166
+ const result = isBambooAttribute(node, context);
1167
+ this.bambooAttributeCache.set(node, result);
1168
+ return Boolean(result);
1169
+ }
1170
+ isBambooProp(node, context) {
1171
+ if (this.bambooPropCache.has(node)) return this.bambooPropCache.get(node);
1172
+ const result = isBambooProp(node, context);
1173
+ this.bambooPropCache.set(node, result);
1174
+ return Boolean(result);
1175
+ }
1176
+ isRecipeVariant(node, context) {
1177
+ if (this.recipeVariantCache.has(node)) return this.recipeVariantCache.get(node);
1178
+ const result = isRecipeVariant(node, context);
1179
+ this.recipeVariantCache.set(node, result);
1180
+ return Boolean(result);
1181
+ }
1182
+ };
1183
+ const extractStringLiteralValue = (valueNode) => {
1184
+ if (isLiteral(valueNode) && typeof valueNode.value === "string") return valueNode.value;
1185
+ if (isJSXExpressionContainer(valueNode) && isLiteral(valueNode.expression) && typeof valueNode.expression.value === "string") return valueNode.expression.value;
1186
+ return null;
1187
+ };
1188
+ const createPropertyReport = (node, longhandName, logical, context) => {
1189
+ const physicalName = `\`${node.name}\`${longhandName !== node.name ? ` (resolved to \`${longhandName}\`)` : ""}`;
1190
+ context.report({
1191
+ data: {
1192
+ logical,
1193
+ physical: physicalName
1194
+ },
1195
+ messageId: "physical",
1196
+ node,
1197
+ suggest: [{
1198
+ data: {
1199
+ logical,
1200
+ physical: node.name
1201
+ },
1202
+ fix: (fixer) => fixer.replaceText(node, logical),
1203
+ messageId: "replace"
1204
+ }]
1205
+ });
1206
+ };
1207
+ const createValueReport = (valueNode, valueText, logical, context) => {
1208
+ context.report({
1209
+ data: {
1210
+ logical: `"${logical}"`,
1211
+ physical: `"${valueText}"`
1212
+ },
1213
+ messageId: "physicalValue",
1214
+ node: valueNode,
1215
+ suggest: [{
1216
+ data: {
1217
+ logical: `"${logical}"`,
1218
+ physical: `"${valueText}"`
1219
+ },
1220
+ fix: (fixer) => {
1221
+ if (isLiteral(valueNode)) return fixer.replaceText(valueNode, `"${logical}"`);
1222
+ if (isJSXExpressionContainer(valueNode) && isLiteral(valueNode.expression)) return fixer.replaceText(valueNode.expression, `"${logical}"`);
1223
+ return null;
1224
+ },
1225
+ messageId: "replace"
1226
+ }]
1227
+ });
1228
+ };
1229
+ const rule$7 = require_utils.createRule({
1230
+ create(context) {
1231
+ const whitelist = context.options[0]?.whitelist ?? [];
1232
+ const cache = new PropertyCache();
1233
+ const checkPropertyName = (node) => {
1234
+ if (whitelist.includes(node.name)) return;
1235
+ const longhandName = cache.getLonghand(node.name, context);
1236
+ if (!(longhandName in physicalProperties)) return;
1237
+ const logical = physicalProperties[longhandName];
1238
+ createPropertyReport(node, longhandName, logical, context);
1239
+ };
1240
+ const checkPropertyValue = (keyNode, valueNode) => {
1241
+ const propertyName = keyNode.name;
1242
+ if (!(propertyName in physicalPropertyValues)) return false;
1243
+ const valueText = extractStringLiteralValue(valueNode);
1244
+ if (valueText === null) return false;
1245
+ const valueMap = physicalPropertyValues[propertyName];
1246
+ if (!valueMap[valueText]) return false;
1247
+ createValueReport(valueNode, valueText, valueMap[valueText], context);
1248
+ return true;
1249
+ };
1250
+ return {
1251
+ JSXAttribute(node) {
1252
+ if (!isJSXIdentifier(node.name)) return;
1253
+ if (!cache.isBambooProp(node, context)) return;
1254
+ checkPropertyName(node.name);
1255
+ if (node.value) checkPropertyValue(node.name, node.value);
1256
+ },
1257
+ Property(node) {
1258
+ if (!isIdentifier(node.key)) return;
1259
+ if (!cache.isBambooAttribute(node, context)) return;
1260
+ if (cache.isRecipeVariant(node, context)) return;
1261
+ checkPropertyName(node.key);
1262
+ if (node.value) checkPropertyValue(node.key, node.value);
1263
+ }
1264
+ };
1265
+ },
1266
+ defaultOptions: [{ whitelist: [] }],
1267
+ meta: {
1268
+ docs: { description: "Encourage the use of logical properties over physical properties to foster a responsive and adaptable user interface." },
1269
+ hasSuggestions: true,
1270
+ messages: MESSAGES,
1271
+ schema: [{
1272
+ additionalProperties: false,
1273
+ properties: { whitelist: {
1274
+ items: {
1275
+ minLength: 0,
1276
+ type: "string"
1277
+ },
1278
+ type: "array",
1279
+ uniqueItems: true
1280
+ } },
1281
+ type: "object"
1282
+ }],
1283
+ type: "suggestion"
1284
+ },
1285
+ name: RULE_NAME$7
1286
+ });
1287
+
1288
+ //#endregion
1289
+ //#region src/rules/no-property-renaming.ts
1290
+ const RULE_NAME$6 = "no-property-renaming";
1291
+ const rule$6 = require_utils.createRule({
1292
+ create(context) {
1293
+ const bambooPropertyCache = /* @__PURE__ */ new WeakMap();
1294
+ const bambooAttributeCache = /* @__PURE__ */ new WeakMap();
1295
+ const recipeVariantCache = /* @__PURE__ */ new WeakMap();
1296
+ const isCachedBambooProperty = (node) => {
1297
+ if (bambooPropertyCache.has(node)) return bambooPropertyCache.get(node);
1298
+ const result = isBambooProp(node, context);
1299
+ bambooPropertyCache.set(node, result);
1300
+ return Boolean(result);
1301
+ };
1302
+ const isCachedBambooAttribute = (node) => {
1303
+ if (bambooAttributeCache.has(node)) return bambooAttributeCache.get(node);
1304
+ const result = isBambooAttribute(node, context);
1305
+ bambooAttributeCache.set(node, result);
1306
+ return Boolean(result);
1307
+ };
1308
+ const isCachedRecipeVariant = (node) => {
1309
+ if (recipeVariantCache.has(node)) return recipeVariantCache.get(node);
1310
+ const result = isRecipeVariant(node, context);
1311
+ recipeVariantCache.set(node, result);
1312
+ return Boolean(result);
1313
+ };
1314
+ const sendReport = (node, expected, property) => {
1315
+ context.report({
1316
+ data: {
1317
+ expected,
1318
+ prop: property
1319
+ },
1320
+ messageId: "noRenaming",
1321
+ node
1322
+ });
1323
+ };
1324
+ const handleReport = (node, value, attribute) => {
1325
+ if (isIdentifier(value) && attribute !== value.name) sendReport(node, attribute, value.name);
1326
+ else if (isMemberExpression(value) && isIdentifier(value.property) && attribute !== value.property.name) sendReport(node, attribute, value.property.name);
1327
+ };
1328
+ return {
1329
+ JSXAttribute(node) {
1330
+ if (!node.value) return;
1331
+ if (!isJSXExpressionContainer(node.value)) return;
1332
+ if (!isCachedBambooProperty(node)) return;
1333
+ const attribute = node.name.name.toString();
1334
+ const expression = node.value.expression;
1335
+ handleReport(node.value, expression, attribute);
1336
+ },
1337
+ Property(node) {
1338
+ if (!isIdentifier(node.key)) return;
1339
+ if (!isIdentifier(node.value) && !isMemberExpression(node.value)) return;
1340
+ if (!isCachedBambooAttribute(node)) return;
1341
+ if (isCachedRecipeVariant(node)) return;
1342
+ const attribute = node.key.name;
1343
+ const value = node.value;
1344
+ handleReport(node.value, value, attribute);
1345
+ }
1346
+ };
1347
+ },
1348
+ defaultOptions: [],
1349
+ meta: {
1350
+ docs: { description: "Ensure that properties for patterns or style props are not renamed, as it prevents proper tracking." },
1351
+ messages: { noRenaming: "Incoming `{{prop}}` prop is different from the expected `{{expected}}` attribute. Bamboo will not track this prop." },
1352
+ schema: [],
1353
+ type: "problem"
1354
+ },
1355
+ name: RULE_NAME$6
1356
+ });
1357
+
1358
+ //#endregion
1359
+ //#region src/rules/no-unsafe-token-fn-usage.ts
1360
+ const RULE_NAME$5 = "no-unsafe-token-fn-usage";
1361
+ const rule$5 = require_utils.createRule({
1362
+ create(context) {
1363
+ let tokenImportCache;
1364
+ const getCachedTokenImport = () => {
1365
+ if (tokenImportCache !== void 0) return tokenImportCache;
1366
+ tokenImportCache = getTokenImport(context);
1367
+ return tokenImportCache;
1368
+ };
1369
+ const isUnsafeCallExpression = (node) => {
1370
+ const tkImport = getCachedTokenImport();
1371
+ return isIdentifier(node.callee) && node.callee.name === tkImport?.alias;
1372
+ };
1373
+ const tokenWrap = (value) => value ? `token(${value})` : "";
1374
+ const isCompositeValue = (input) => {
1375
+ if (!input) return false;
1376
+ return !/^(?:token\([^)]*\)|\{[^}]*\})$/.test(input);
1377
+ };
1378
+ const sendReport = (node, value) => {
1379
+ const tkImports = extractTokens(value);
1380
+ if (!tkImports.length) return;
1381
+ const token = tkImports[0].replace(/^[^.]*\./, "");
1382
+ context.report({
1383
+ messageId: "noUnsafeTokenFnUsage",
1384
+ node,
1385
+ suggest: [{
1386
+ data: { safe: token },
1387
+ fix: (fixer) => fixer.replaceText(node, `'${token}'`),
1388
+ messageId: "replace"
1389
+ }]
1390
+ });
1391
+ };
1392
+ const handleRuntimeFunction = (node) => {
1393
+ if (!isCallExpression(node)) return;
1394
+ if (!isUnsafeCallExpression(node)) return;
1395
+ const value = node.arguments[0];
1396
+ if (isLiteral(value)) sendReport(node, tokenWrap((0, _bamboocss_shared.getArbitraryValue)(value.value?.toString() ?? "")));
1397
+ else if (isTemplateLiteral(value) && value.expressions.length === 0) sendReport(node, tokenWrap((0, _bamboocss_shared.getArbitraryValue)(value.quasis[0].value.raw)));
1398
+ };
1399
+ const handleLiteral = (node) => {
1400
+ if (!isLiteral(node)) return;
1401
+ const value = (0, _bamboocss_shared.getArbitraryValue)(node.value?.toString() ?? "");
1402
+ if (isCompositeValue(value)) return;
1403
+ sendReport(node, value);
1404
+ };
1405
+ const handleTemplateLiteral = (node) => {
1406
+ if (!isTemplateLiteral(node) || node.expressions.length > 0) return;
1407
+ const value = (0, _bamboocss_shared.getArbitraryValue)(node.quasis[0].value.raw);
1408
+ if (isCompositeValue(value)) return;
1409
+ sendReport(node, value);
1410
+ };
1411
+ const bambooPropertyCache = /* @__PURE__ */ new WeakMap();
1412
+ const isCachedBambooProperty = (node) => {
1413
+ if (bambooPropertyCache.has(node)) return bambooPropertyCache.get(node);
1414
+ const result = isBambooProp(node, context);
1415
+ bambooPropertyCache.set(node, result);
1416
+ return Boolean(result);
1417
+ };
1418
+ const bambooAttributeCache = /* @__PURE__ */ new WeakMap();
1419
+ const isCachedBambooAttribute = (node) => {
1420
+ if (bambooAttributeCache.has(node)) return bambooAttributeCache.get(node);
1421
+ const result = isBambooAttribute(node, context);
1422
+ bambooAttributeCache.set(node, result);
1423
+ return Boolean(result);
1424
+ };
1425
+ const recipeVariantCache = /* @__PURE__ */ new WeakMap();
1426
+ const isCachedRecipeVariant = (node) => {
1427
+ if (recipeVariantCache.has(node)) return recipeVariantCache.get(node);
1428
+ const result = isRecipeVariant(node, context);
1429
+ recipeVariantCache.set(node, result);
1430
+ return Boolean(result);
1431
+ };
1432
+ return {
1433
+ JSXAttribute(node) {
1434
+ if (!node.value) return;
1435
+ if (!isCachedBambooProperty(node)) return;
1436
+ handleLiteral(node.value);
1437
+ if (isJSXExpressionContainer(node.value)) {
1438
+ const expression = node.value.expression;
1439
+ handleLiteral(expression);
1440
+ handleTemplateLiteral(expression);
1441
+ handleRuntimeFunction(expression);
1442
+ }
1443
+ },
1444
+ Property(node) {
1445
+ if (!isCachedBambooAttribute(node)) return;
1446
+ if (isCachedRecipeVariant(node)) return;
1447
+ const valueNode = node.value;
1448
+ if (isCallExpression(valueNode) || isLiteral(valueNode) || isTemplateLiteral(valueNode)) {
1449
+ handleRuntimeFunction(valueNode);
1450
+ handleLiteral(valueNode);
1451
+ handleTemplateLiteral(valueNode);
1452
+ }
1453
+ }
1454
+ };
1455
+ },
1456
+ defaultOptions: [],
1457
+ meta: {
1458
+ docs: { description: "Prevent users from using the token function in situations where they could simply use the raw design token." },
1459
+ hasSuggestions: true,
1460
+ messages: {
1461
+ noUnsafeTokenFnUsage: "Unnecessary token function usage. Prefer design token.",
1462
+ replace: "Replace token function with `{{safe}}`."
1463
+ },
1464
+ schema: [],
1465
+ type: "suggestion"
1466
+ },
1467
+ name: RULE_NAME$5
1468
+ });
1469
+
1470
+ //#endregion
1471
+ //#region src/utils/composite-properties.ts
1472
+ const compositeProperties = {
1473
+ animation: [
1474
+ "animationName",
1475
+ "animationDuration",
1476
+ "animationTimingFunction",
1477
+ "animationDelay",
1478
+ "animationIterationCount",
1479
+ "animationDirection",
1480
+ "animationFillMode",
1481
+ "animationPlayState"
1482
+ ],
1483
+ background: [
1484
+ "backgroundImage",
1485
+ "backgroundPosition",
1486
+ "backgroundSize",
1487
+ "backgroundRepeat",
1488
+ "backgroundAttachment",
1489
+ "backgroundOrigin",
1490
+ "backgroundClip",
1491
+ "backgroundColor"
1492
+ ],
1493
+ backgroundPosition: ["backgroundPositionX", "backgroundPositionY"],
1494
+ border: [
1495
+ "borderWidth",
1496
+ "borderStyle",
1497
+ "borderColor"
1498
+ ],
1499
+ borderBlockEnd: [
1500
+ "borderBlockEndWidth",
1501
+ "borderBlockEndStyle",
1502
+ "borderBlockEndColor"
1503
+ ],
1504
+ borderBlockStart: [
1505
+ "borderBlockStartWidth",
1506
+ "borderBlockStartStyle",
1507
+ "borderBlockStartColor"
1508
+ ],
1509
+ borderBottom: [
1510
+ "borderBottomWidth",
1511
+ "borderBottomStyle",
1512
+ "borderBottomColor"
1513
+ ],
1514
+ borderColor: [
1515
+ "borderTopColor",
1516
+ "borderRightColor",
1517
+ "borderBottomColor",
1518
+ "borderLeftColor"
1519
+ ],
1520
+ borderImage: [
1521
+ "borderImageSource",
1522
+ "borderImageSlice",
1523
+ "borderImageWidth",
1524
+ "borderImageOutset",
1525
+ "borderImageRepeat"
1526
+ ],
1527
+ borderInlineEnd: [
1528
+ "borderInlineEndWidth",
1529
+ "borderInlineEndStyle",
1530
+ "borderInlineEndColor"
1531
+ ],
1532
+ borderInlineStart: [
1533
+ "borderInlineStartWidth",
1534
+ "borderInlineStartStyle",
1535
+ "borderInlineStartColor"
1536
+ ],
1537
+ borderLeft: [
1538
+ "borderLeftWidth",
1539
+ "borderLeftStyle",
1540
+ "borderLeftColor"
1541
+ ],
1542
+ borderRadius: [
1543
+ "borderTopLeftRadius",
1544
+ "borderTopRightRadius",
1545
+ "borderBottomRightRadius",
1546
+ "borderBottomLeftRadius"
1547
+ ],
1548
+ borderRight: [
1549
+ "borderRightWidth",
1550
+ "borderRightStyle",
1551
+ "borderRightColor"
1552
+ ],
1553
+ borderStyle: [
1554
+ "borderTopStyle",
1555
+ "borderRightStyle",
1556
+ "borderBottomStyle",
1557
+ "borderLeftStyle"
1558
+ ],
1559
+ borderTop: [
1560
+ "borderTopWidth",
1561
+ "borderTopStyle",
1562
+ "borderTopColor"
1563
+ ],
1564
+ borderWidth: [
1565
+ "borderTopWidth",
1566
+ "borderRightWidth",
1567
+ "borderBottomWidth",
1568
+ "borderLeftWidth"
1569
+ ],
1570
+ columnRule: [
1571
+ "columnRuleWidth",
1572
+ "columnRuleStyle",
1573
+ "columnRuleColor"
1574
+ ],
1575
+ columns: ["columnWidth", "columnCount"],
1576
+ container: ["contain", "content"],
1577
+ containIntrinsicSize: ["containIntrinsicSizeInline", "containIntrinsicSizeBlock"],
1578
+ cue: ["cueBefore", "cueAfter"],
1579
+ flex: [
1580
+ "flexGrow",
1581
+ "flexShrink",
1582
+ "flexBasis"
1583
+ ],
1584
+ flexFlow: ["flexDirection", "flexWrap"],
1585
+ font: [
1586
+ "fontStyle",
1587
+ "fontVariantCaps",
1588
+ "fontVariantEastAsian",
1589
+ "fontVariantLigatures",
1590
+ "fontVariantNumeric",
1591
+ "fontVariantPosition",
1592
+ "fontWeight",
1593
+ "fontStretch",
1594
+ "fontSize",
1595
+ "lineHeight",
1596
+ "fontFamily"
1597
+ ],
1598
+ fontSynthesis: [
1599
+ "fontSynthesisWeight",
1600
+ "fontSynthesisStyle",
1601
+ "fontSynthesisSmallCaps"
1602
+ ],
1603
+ fontVariant: [
1604
+ "fontVariantCaps",
1605
+ "fontVariantEastAsian",
1606
+ "fontVariantLigatures",
1607
+ "fontVariantNumeric",
1608
+ "fontVariantPosition"
1609
+ ],
1610
+ gap: ["columnGap", "rowGap"],
1611
+ grid: [
1612
+ "gridTemplateColumns",
1613
+ "gridTemplateRows",
1614
+ "gridTemplateAreas",
1615
+ "gridAutoColumns",
1616
+ "gridAutoRows",
1617
+ "gridAutoFlow"
1618
+ ],
1619
+ gridArea: [
1620
+ "gridRowStart",
1621
+ "gridColumnStart",
1622
+ "gridRowEnd",
1623
+ "gridColumnEnd"
1624
+ ],
1625
+ gridColumn: ["gridColumnStart", "gridColumnEnd"],
1626
+ gridGap: ["gridColumnGap", "gridRowGap"],
1627
+ gridRow: ["gridRowStart", "gridRowEnd"],
1628
+ gridTemplate: [
1629
+ "gridTemplateColumns",
1630
+ "gridTemplateRows",
1631
+ "gridTemplateAreas"
1632
+ ],
1633
+ inset: [
1634
+ "top",
1635
+ "right",
1636
+ "bottom",
1637
+ "left"
1638
+ ],
1639
+ listStyle: [
1640
+ "listStyleType",
1641
+ "listStylePosition",
1642
+ "listStyleImage"
1643
+ ],
1644
+ margin: [
1645
+ "marginTop",
1646
+ "marginRight",
1647
+ "marginBottom",
1648
+ "marginLeft"
1649
+ ],
1650
+ mask: [
1651
+ "maskImage",
1652
+ "maskMode",
1653
+ "maskRepeat",
1654
+ "maskPosition",
1655
+ "maskClip",
1656
+ "maskOrigin",
1657
+ "maskSize",
1658
+ "maskComposite"
1659
+ ],
1660
+ maskBorder: [
1661
+ "maskBorderSource",
1662
+ "maskBorderMode",
1663
+ "maskBorderSlice",
1664
+ "maskBorderWidth",
1665
+ "maskBorderOutset",
1666
+ "maskBorderRepeat"
1667
+ ],
1668
+ offset: [
1669
+ "offsetPosition",
1670
+ "offsetPath",
1671
+ "offsetDistance",
1672
+ "offsetRotate",
1673
+ "offsetAnchor"
1674
+ ],
1675
+ outline: [
1676
+ "outlineWidth",
1677
+ "outlineStyle",
1678
+ "outlineColor"
1679
+ ],
1680
+ overflow: ["overflowX", "overflowY"],
1681
+ padding: [
1682
+ "paddingTop",
1683
+ "paddingRight",
1684
+ "paddingBottom",
1685
+ "paddingLeft"
1686
+ ],
1687
+ pause: ["pauseBefore", "pauseAfter"],
1688
+ placeContent: ["alignContent", "justifyContent"],
1689
+ placeItems: ["alignItems", "justifyItems"],
1690
+ placeSelf: ["alignSelf", "justifySelf"],
1691
+ rest: ["restBefore", "restAfter"],
1692
+ scrollMargin: [
1693
+ "scrollMarginTop",
1694
+ "scrollMarginRight",
1695
+ "scrollMarginBottom",
1696
+ "scrollMarginLeft"
1697
+ ],
1698
+ scrollPadding: [
1699
+ "scrollPaddingTop",
1700
+ "scrollPaddingRight",
1701
+ "scrollPaddingBottom",
1702
+ "scrollPaddingLeft"
1703
+ ],
1704
+ scrollPaddingBlock: ["scrollPaddingBlockStart", "scrollPaddingBlockEnd"],
1705
+ scrollPaddingInline: ["scrollPaddingInlineStart", "scrollPaddingInlineEnd"],
1706
+ scrollSnapMargin: [
1707
+ "scrollSnapMarginTop",
1708
+ "scrollSnapMarginRight",
1709
+ "scrollSnapMarginBottom",
1710
+ "scrollSnapMarginLeft"
1711
+ ],
1712
+ scrollSnapMarginBlock: ["scrollSnapMarginBlockStart", "scrollSnapMarginBlockEnd"],
1713
+ scrollSnapMarginInline: ["scrollSnapMarginInlineStart", "scrollSnapMarginInlineEnd"],
1714
+ scrollTimeline: ["scrollTimelineSource", "scrollTimelineOrientation"],
1715
+ textDecoration: [
1716
+ "textDecorationLine",
1717
+ "textDecorationStyle",
1718
+ "textDecorationColor"
1719
+ ],
1720
+ textEmphasis: ["textEmphasisStyle", "textEmphasisColor"],
1721
+ transition: [
1722
+ "transitionProperty",
1723
+ "transitionDuration",
1724
+ "transitionTimingFunction",
1725
+ "transitionDelay"
1726
+ ]
1727
+ };
1728
+
1729
+ //#endregion
1730
+ //#region src/rules/prefer-atomic-properties.ts
1731
+ const RULE_NAME$4 = "prefer-atomic-properties";
1732
+ const rule$4 = require_utils.createRule({
1733
+ create(context) {
1734
+ const whitelist = context.options[0]?.whitelist ?? [];
1735
+ const longhandCache = /* @__PURE__ */ new Map();
1736
+ const getLonghand = (name) => {
1737
+ if (longhandCache.has(name)) return longhandCache.get(name);
1738
+ const longhand = resolveLonghand(name, context) ?? name;
1739
+ longhandCache.set(name, longhand);
1740
+ return longhand;
1741
+ };
1742
+ const compositePropertyCache = /* @__PURE__ */ new Map();
1743
+ const resolveCompositeProperty = (name) => {
1744
+ if (compositePropertyCache.has(name)) return compositePropertyCache.get(name);
1745
+ if (Object.hasOwn(compositeProperties, name)) {
1746
+ compositePropertyCache.set(name, name);
1747
+ return name;
1748
+ }
1749
+ const longhand = getLonghand(name);
1750
+ if (isValidProperty(longhand, context) && Object.hasOwn(compositeProperties, longhand)) {
1751
+ compositePropertyCache.set(name, longhand);
1752
+ return longhand;
1753
+ }
1754
+ compositePropertyCache.set(name, void 0);
1755
+ };
1756
+ const bambooPropertyCache = /* @__PURE__ */ new WeakMap();
1757
+ const isCachedBambooProperty = (node) => {
1758
+ if (bambooPropertyCache.has(node)) return bambooPropertyCache.get(node);
1759
+ const result = isBambooProp(node, context);
1760
+ bambooPropertyCache.set(node, result);
1761
+ return Boolean(result);
1762
+ };
1763
+ const bambooAttributeCache = /* @__PURE__ */ new WeakMap();
1764
+ const isCachedBambooAttribute = (node) => {
1765
+ if (bambooAttributeCache.has(node)) return bambooAttributeCache.get(node);
1766
+ const result = isBambooAttribute(node, context);
1767
+ bambooAttributeCache.set(node, result);
1768
+ return Boolean(result);
1769
+ };
1770
+ const recipeVariantCache = /* @__PURE__ */ new WeakMap();
1771
+ const isCachedRecipeVariant = (node) => {
1772
+ if (recipeVariantCache.has(node)) return recipeVariantCache.get(node);
1773
+ const result = isRecipeVariant(node, context);
1774
+ recipeVariantCache.set(node, result);
1775
+ return Boolean(result);
1776
+ };
1777
+ const sendReport = (node, composite) => {
1778
+ if (whitelist.includes(node.name)) return;
1779
+ const atomics = compositeProperties[composite].map((name) => `\`${name}\``).join(",\n");
1780
+ context.report({
1781
+ data: {
1782
+ atomics,
1783
+ composite: node.name
1784
+ },
1785
+ messageId: "atomic",
1786
+ node
1787
+ });
1788
+ };
1789
+ return {
1790
+ JSXAttribute(node) {
1791
+ if (!isJSXIdentifier(node.name)) return;
1792
+ if (!isCachedBambooProperty(node)) return;
1793
+ const composite = resolveCompositeProperty(node.name.name);
1794
+ if (!composite) return;
1795
+ sendReport(node.name, composite);
1796
+ },
1797
+ Property(node) {
1798
+ if (!isIdentifier(node.key)) return;
1799
+ if (!isCachedBambooAttribute(node)) return;
1800
+ if (isCachedRecipeVariant(node)) return;
1801
+ const composite = resolveCompositeProperty(node.key.name);
1802
+ if (!composite) return;
1803
+ sendReport(node.key, composite);
1804
+ }
1805
+ };
1806
+ },
1807
+ defaultOptions: [{ whitelist: [] }],
1808
+ meta: {
1809
+ docs: { description: "Encourage the use of atomic properties instead of composite properties in the codebase." },
1810
+ messages: { atomic: "Use atomic properties instead of `{{composite}}`. Prefer: \n{{atomics}}" },
1811
+ schema: [{
1812
+ additionalProperties: false,
1813
+ properties: { whitelist: {
1814
+ items: {
1815
+ minLength: 0,
1816
+ type: "string"
1817
+ },
1818
+ type: "array",
1819
+ uniqueItems: true
1820
+ } },
1821
+ type: "object"
1822
+ }],
1823
+ type: "suggestion"
1824
+ },
1825
+ name: RULE_NAME$4
1826
+ });
1827
+
1828
+ //#endregion
1829
+ //#region src/rules/prefer-composite-properties.ts
1830
+ const RULE_NAME$3 = "prefer-composite-properties";
1831
+ const rule$3 = require_utils.createRule({
1832
+ create(context) {
1833
+ const whitelist = context.options[0]?.whitelist ?? [];
1834
+ const longhandCache = /* @__PURE__ */ new Map();
1835
+ const getLonghand = (name) => {
1836
+ if (longhandCache.has(name)) return longhandCache.get(name);
1837
+ const longhand = resolveLonghand(name, context) ?? name;
1838
+ longhandCache.set(name, longhand);
1839
+ return longhand;
1840
+ };
1841
+ const compositePropertyCache = /* @__PURE__ */ new Map();
1842
+ const resolveCompositeProperty = (name) => {
1843
+ if (compositePropertyCache.has(name)) return compositePropertyCache.get(name);
1844
+ const longhand = getLonghand(name);
1845
+ if (!isValidProperty(longhand, context)) {
1846
+ compositePropertyCache.set(name, void 0);
1847
+ return;
1848
+ }
1849
+ const composite = Object.keys(compositeProperties).find((cpd) => compositeProperties[cpd].includes(longhand));
1850
+ compositePropertyCache.set(name, composite);
1851
+ return composite;
1852
+ };
1853
+ const bambooPropertyCache = /* @__PURE__ */ new WeakMap();
1854
+ const isCachedBambooProperty = (node) => {
1855
+ if (bambooPropertyCache.has(node)) return bambooPropertyCache.get(node);
1856
+ const result = isBambooProp(node, context);
1857
+ bambooPropertyCache.set(node, result);
1858
+ return Boolean(result);
1859
+ };
1860
+ const bambooAttributeCache = /* @__PURE__ */ new WeakMap();
1861
+ const isCachedBambooAttribute = (node) => {
1862
+ if (bambooAttributeCache.has(node)) return bambooAttributeCache.get(node);
1863
+ const result = isBambooAttribute(node, context);
1864
+ bambooAttributeCache.set(node, result);
1865
+ return Boolean(result);
1866
+ };
1867
+ const recipeVariantCache = /* @__PURE__ */ new WeakMap();
1868
+ const isCachedRecipeVariant = (node) => {
1869
+ if (recipeVariantCache.has(node)) return recipeVariantCache.get(node);
1870
+ const result = isRecipeVariant(node, context);
1871
+ recipeVariantCache.set(node, result);
1872
+ return Boolean(result);
1873
+ };
1874
+ const sendReport = (node, composite) => {
1875
+ if (whitelist.includes(node.name)) return;
1876
+ context.report({
1877
+ data: {
1878
+ atomic: node.name,
1879
+ composite
1880
+ },
1881
+ messageId: "composite",
1882
+ node
1883
+ });
1884
+ };
1885
+ return {
1886
+ JSXAttribute(node) {
1887
+ if (!isJSXIdentifier(node.name)) return;
1888
+ if (!isCachedBambooProperty(node)) return;
1889
+ const composite = resolveCompositeProperty(node.name.name);
1890
+ if (!composite) return;
1891
+ sendReport(node.name, composite);
1892
+ },
1893
+ Property(node) {
1894
+ if (!isIdentifier(node.key)) return;
1895
+ if (!isCachedBambooAttribute(node)) return;
1896
+ if (isCachedRecipeVariant(node)) return;
1897
+ const composite = resolveCompositeProperty(node.key.name);
1898
+ if (!composite) return;
1899
+ sendReport(node.key, composite);
1900
+ }
1901
+ };
1902
+ },
1903
+ defaultOptions: [{ whitelist: [] }],
1904
+ meta: {
1905
+ docs: { description: "Encourage the use of composite properties instead of atomic properties in the codebase." },
1906
+ messages: { composite: "Use composite property instead of `{{atomic}}`. Prefer: `{{composite}}`." },
1907
+ schema: [{
1908
+ additionalProperties: false,
1909
+ properties: { whitelist: {
1910
+ items: {
1911
+ minLength: 0,
1912
+ type: "string"
1913
+ },
1914
+ type: "array",
1915
+ uniqueItems: true
1916
+ } },
1917
+ type: "object"
1918
+ }],
1919
+ type: "suggestion"
1920
+ },
1921
+ name: RULE_NAME$3
1922
+ });
1923
+
1924
+ //#endregion
1925
+ //#region src/rules/prefer-longhand-properties.ts
1926
+ const RULE_NAME$2 = "prefer-longhand-properties";
1927
+ const rule$2 = require_utils.createRule({
1928
+ create(context) {
1929
+ const whitelist = context.options[0]?.whitelist ?? [];
1930
+ const longhandCache = /* @__PURE__ */ new Map();
1931
+ const getLonghand = (name) => {
1932
+ if (longhandCache.has(name)) return longhandCache.get(name);
1933
+ const longhand = resolveLonghand(name, context);
1934
+ longhandCache.set(name, longhand);
1935
+ return longhand;
1936
+ };
1937
+ const bambooPropertyCache = /* @__PURE__ */ new WeakMap();
1938
+ const isCachedBambooProperty = (node) => {
1939
+ if (bambooPropertyCache.has(node)) return bambooPropertyCache.get(node);
1940
+ const result = isBambooProp(node, context);
1941
+ bambooPropertyCache.set(node, result);
1942
+ return Boolean(result);
1943
+ };
1944
+ const bambooAttributeCache = /* @__PURE__ */ new WeakMap();
1945
+ const isCachedBambooAttribute = (node) => {
1946
+ if (bambooAttributeCache.has(node)) return bambooAttributeCache.get(node);
1947
+ const result = isBambooAttribute(node, context);
1948
+ bambooAttributeCache.set(node, result);
1949
+ return Boolean(result);
1950
+ };
1951
+ const recipeVariantCache = /* @__PURE__ */ new WeakMap();
1952
+ const isCachedRecipeVariant = (node) => {
1953
+ if (recipeVariantCache.has(node)) return recipeVariantCache.get(node);
1954
+ const result = isRecipeVariant(node, context);
1955
+ recipeVariantCache.set(node, result);
1956
+ return Boolean(result);
1957
+ };
1958
+ const sendReport = (node) => {
1959
+ if (whitelist.includes(node.name)) return;
1960
+ const longhand = getLonghand(node.name);
1961
+ if (!longhand || longhand === node.name) return;
1962
+ const data = {
1963
+ longhand,
1964
+ shorthand: node.name
1965
+ };
1966
+ context.report({
1967
+ data,
1968
+ messageId: "longhand",
1969
+ node,
1970
+ suggest: [{
1971
+ data,
1972
+ fix: (fixer) => fixer.replaceText(node, longhand),
1973
+ messageId: "replace"
1974
+ }]
1975
+ });
1976
+ };
1977
+ return {
1978
+ JSXAttribute(node) {
1979
+ if (!isJSXIdentifier(node.name)) return;
1980
+ if (!isCachedBambooProperty(node)) return;
1981
+ sendReport(node.name);
1982
+ },
1983
+ Property(node) {
1984
+ if (!isIdentifier(node.key)) return;
1985
+ if (!isCachedBambooAttribute(node)) return;
1986
+ if (isCachedRecipeVariant(node)) return;
1987
+ sendReport(node.key);
1988
+ }
1989
+ };
1990
+ },
1991
+ defaultOptions: [{ whitelist: [] }],
1992
+ meta: {
1993
+ docs: { description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase." },
1994
+ hasSuggestions: true,
1995
+ messages: {
1996
+ longhand: "Use longhand property instead of `{{shorthand}}`. Prefer `{{longhand}}`.",
1997
+ replace: "Replace `{{shorthand}}` with `{{longhand}}`."
1998
+ },
1999
+ schema: [{
2000
+ additionalProperties: false,
2001
+ properties: { whitelist: {
2002
+ items: {
2003
+ minLength: 0,
2004
+ type: "string"
2005
+ },
2006
+ type: "array",
2007
+ uniqueItems: true
2008
+ } },
2009
+ type: "object"
2010
+ }],
2011
+ type: "suggestion"
2012
+ },
2013
+ name: RULE_NAME$2
2014
+ });
2015
+
2016
+ //#endregion
2017
+ //#region src/rules/prefer-shorthand-properties.ts
2018
+ const RULE_NAME$1 = "prefer-shorthand-properties";
2019
+ const rule$1 = require_utils.createRule({
2020
+ create(context) {
2021
+ const whitelist = context.options[0]?.whitelist ?? [];
2022
+ const longhandCache = /* @__PURE__ */ new Map();
2023
+ const getLonghand = (name) => {
2024
+ if (longhandCache.has(name)) return longhandCache.get(name);
2025
+ const longhand = resolveLonghand(name, context);
2026
+ longhandCache.set(name, longhand);
2027
+ return longhand;
2028
+ };
2029
+ const shorthandsCache = /* @__PURE__ */ new Map();
2030
+ const getShorthands = (name) => {
2031
+ if (shorthandsCache.has(name)) return shorthandsCache.get(name);
2032
+ const shorthands = resolveShorthands(name, context);
2033
+ shorthandsCache.set(name, shorthands);
2034
+ return shorthands;
2035
+ };
2036
+ const bambooPropertyCache = /* @__PURE__ */ new WeakMap();
2037
+ const isCachedBambooProperty = (node) => {
2038
+ if (bambooPropertyCache.has(node)) return bambooPropertyCache.get(node);
2039
+ const result = isBambooProp(node, context);
2040
+ bambooPropertyCache.set(node, result);
2041
+ return Boolean(result);
2042
+ };
2043
+ const bambooAttributeCache = /* @__PURE__ */ new WeakMap();
2044
+ const isCachedBambooAttribute = (node) => {
2045
+ if (bambooAttributeCache.has(node)) return bambooAttributeCache.get(node);
2046
+ const result = isBambooAttribute(node, context);
2047
+ bambooAttributeCache.set(node, result);
2048
+ return Boolean(result);
2049
+ };
2050
+ const recipeVariantCache = /* @__PURE__ */ new WeakMap();
2051
+ const isCachedRecipeVariant = (node) => {
2052
+ if (recipeVariantCache.has(node)) return recipeVariantCache.get(node);
2053
+ const result = isRecipeVariant(node, context);
2054
+ recipeVariantCache.set(node, result);
2055
+ return Boolean(result);
2056
+ };
2057
+ const sendReport = (node) => {
2058
+ if (whitelist.includes(node.name)) return;
2059
+ if (getLonghand(node.name)) return;
2060
+ const shorthands = getShorthands(node.name);
2061
+ if (!shorthands || shorthands.length === 0) return;
2062
+ const shorthandList = shorthands.map((s) => `\`${s}\``).join(", ");
2063
+ const data = {
2064
+ longhand: node.name,
2065
+ shorthand: shorthandList
2066
+ };
2067
+ context.report({
2068
+ data,
2069
+ messageId: "shorthand",
2070
+ node,
2071
+ suggest: [{
2072
+ data,
2073
+ fix: (fixer) => fixer.replaceText(node, shorthands[0]),
2074
+ messageId: "replace"
2075
+ }]
2076
+ });
2077
+ };
2078
+ return {
2079
+ JSXAttribute(node) {
2080
+ if (!isJSXIdentifier(node.name)) return;
2081
+ if (!isCachedBambooProperty(node)) return;
2082
+ sendReport(node.name);
2083
+ },
2084
+ Property(node) {
2085
+ if (!isIdentifier(node.key)) return;
2086
+ if (!isCachedBambooAttribute(node)) return;
2087
+ if (isCachedRecipeVariant(node)) return;
2088
+ sendReport(node.key);
2089
+ }
2090
+ };
2091
+ },
2092
+ defaultOptions: [{ whitelist: [] }],
2093
+ meta: {
2094
+ docs: { description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase." },
2095
+ hasSuggestions: true,
2096
+ messages: {
2097
+ replace: "Replace `{{longhand}}` with `{{shorthand}}`.",
2098
+ shorthand: "Use shorthand property instead of `{{longhand}}`. Prefer `{{shorthand}}`."
2099
+ },
2100
+ schema: [{
2101
+ additionalProperties: false,
2102
+ properties: { whitelist: {
2103
+ items: {
2104
+ minLength: 0,
2105
+ type: "string"
2106
+ },
2107
+ type: "array",
2108
+ uniqueItems: true
2109
+ } },
2110
+ type: "object"
2111
+ }],
2112
+ type: "suggestion"
2113
+ },
2114
+ name: RULE_NAME$1
2115
+ });
2116
+
2117
+ //#endregion
2118
+ //#region src/rules/prefer-unified-property-style.ts
2119
+ const RULE_NAME = "prefer-unified-property-style";
2120
+ const rule = require_utils.createRule({
2121
+ create(context) {
2122
+ const longhandCache = /* @__PURE__ */ new Map();
2123
+ const getLonghand = (name) => {
2124
+ if (longhandCache.has(name)) return longhandCache.get(name);
2125
+ const longhand = resolveLonghand(name, context) ?? name;
2126
+ longhandCache.set(name, longhand);
2127
+ return longhand;
2128
+ };
2129
+ const compositePropertyCache = /* @__PURE__ */ new Map();
2130
+ const resolveCompositeProperty = (name) => {
2131
+ if (compositePropertyCache.has(name)) return compositePropertyCache.get(name);
2132
+ if (name in compositeProperties) {
2133
+ compositePropertyCache.set(name, name);
2134
+ return name;
2135
+ }
2136
+ const longhand = getLonghand(name);
2137
+ if (isValidProperty(longhand, context) && longhand in compositeProperties) {
2138
+ compositePropertyCache.set(name, longhand);
2139
+ return longhand;
2140
+ }
2141
+ compositePropertyCache.set(name, void 0);
2142
+ };
2143
+ const bambooPropertyCache = /* @__PURE__ */ new WeakMap();
2144
+ const isCachedBambooProperty = (node) => {
2145
+ if (bambooPropertyCache.has(node)) return bambooPropertyCache.get(node);
2146
+ const result = isBambooProp(node, context);
2147
+ bambooPropertyCache.set(node, result);
2148
+ return Boolean(result);
2149
+ };
2150
+ const bambooAttributeCache = /* @__PURE__ */ new WeakMap();
2151
+ const isCachedBambooAttribute = (node) => {
2152
+ if (bambooAttributeCache.has(node)) return bambooAttributeCache.get(node);
2153
+ const result = isBambooAttribute(node, context);
2154
+ bambooAttributeCache.set(node, result);
2155
+ return Boolean(result);
2156
+ };
2157
+ const recipeVariantCache = /* @__PURE__ */ new WeakMap();
2158
+ const isCachedRecipeVariant = (node) => {
2159
+ if (recipeVariantCache.has(node)) return recipeVariantCache.get(node);
2160
+ const result = isRecipeVariant(node, context);
2161
+ recipeVariantCache.set(node, result);
2162
+ return Boolean(result);
2163
+ };
2164
+ const sendReport = (node, composite, siblings) => {
2165
+ const atomicPropertiesSet = new Set(siblings.filter((property) => compositeProperties[composite].includes(getLonghand(property))));
2166
+ if (atomicPropertiesSet.size === 0) return;
2167
+ const atomicProperties = Array.from(atomicPropertiesSet).map((property) => `\`${property}\``).join(", ");
2168
+ const atomics = compositeProperties[composite].map((name) => `\`${name}\``).join(", ");
2169
+ context.report({
2170
+ data: {
2171
+ atomicProperties,
2172
+ atomics,
2173
+ composite
2174
+ },
2175
+ messageId: "unify",
2176
+ node
2177
+ });
2178
+ };
2179
+ return {
2180
+ JSXAttribute(node) {
2181
+ if (!isJSXIdentifier(node.name)) return;
2182
+ if (!isCachedBambooProperty(node)) return;
2183
+ const composite = resolveCompositeProperty(node.name.name);
2184
+ if (!composite) return;
2185
+ if (!isJSXOpeningElement(node.parent)) return;
2186
+ sendReport(node, composite, node.parent.attributes.map((attribute) => attribute.name.name));
2187
+ },
2188
+ Property(node) {
2189
+ if (!isIdentifier(node.key)) return;
2190
+ if (!isCachedBambooAttribute(node)) return;
2191
+ if (isCachedRecipeVariant(node)) return;
2192
+ const composite = resolveCompositeProperty(node.key.name);
2193
+ if (!composite) return;
2194
+ if (!isObjectExpression(node.parent)) return;
2195
+ const siblings = node.parent.properties.filter((property) => property.type === "Property").map((property) => isIdentifier(property.key) ? property.key.name : "");
2196
+ sendReport(node.key, composite, siblings);
2197
+ }
2198
+ };
2199
+ },
2200
+ defaultOptions: [],
2201
+ meta: {
2202
+ docs: { description: "Discourage mixing atomic and composite forms of the same property in a style declaration. Atomic styles give more consistent results." },
2203
+ messages: { unify: "You're mixing atomic {{atomicProperties}} with composite property `{{composite}}`. Prefer atomic styling to mixing atomic and composite properties. Remove `{{composite}}` and use one or more of {{atomics}} instead." },
2204
+ schema: [],
2205
+ type: "suggestion"
2206
+ },
2207
+ name: RULE_NAME
2208
+ });
2209
+
2210
+ //#endregion
2211
+ //#region src/rules/index.ts
2212
+ const rules = {
2213
+ [RULE_NAME$18]: rule$18,
2214
+ [RULE_NAME$17]: rule$17,
2215
+ [RULE_NAME$16]: rule$16,
2216
+ [RULE_NAME$15]: rule$15,
2217
+ [RULE_NAME$14]: rule$14,
2218
+ [RULE_NAME$13]: rule$13,
2219
+ [RULE_NAME$12]: rule$12,
2220
+ [RULE_NAME$11]: rule$11,
2221
+ [RULE_NAME$10]: rule$10,
2222
+ [RULE_NAME$9]: rule$9,
2223
+ [RULE_NAME$8]: rule$8,
2224
+ [RULE_NAME$7]: rule$7,
2225
+ [RULE_NAME$6]: rule$6,
2226
+ [RULE_NAME$5]: rule$5,
2227
+ [RULE_NAME$4]: rule$4,
2228
+ [RULE_NAME$3]: rule$3,
2229
+ [RULE_NAME$2]: rule$2,
2230
+ [RULE_NAME$1]: rule$1,
2231
+ [RULE_NAME]: rule
2232
+ };
2233
+
2234
+ //#endregion
2235
+ //#region src/configs/all.ts
2236
+ const errorRules = [
2237
+ RULE_NAME$18,
2238
+ RULE_NAME$17,
2239
+ RULE_NAME$9
2240
+ ];
2241
+ const allRules = Object.fromEntries(Object.entries(rules).map(([name]) => {
2242
+ return [`@bamboocss/${name}`, errorRules.includes(name) ? "error" : "warn"];
2243
+ }));
2244
+ var all_default = {
2245
+ parser: "@typescript-eslint/parser",
2246
+ parserOptions: { sourceType: "module" },
2247
+ plugins: ["@bamboocss"],
2248
+ rules: allRules
2249
+ };
2250
+
2251
+ //#endregion
2252
+ //#region src/configs/recommended.ts
2253
+ var recommended_default = {
2254
+ parser: "@typescript-eslint/parser",
2255
+ parserOptions: { sourceType: "module" },
2256
+ plugins: ["@bamboocss"],
2257
+ rules: {
2258
+ "@bamboocss/file-not-included": "error",
2259
+ "@bamboocss/no-config-function-in-source": "error",
2260
+ "@bamboocss/no-debug": "warn",
2261
+ "@bamboocss/no-deprecated-tokens": "warn",
2262
+ "@bamboocss/no-dynamic-styling": "warn",
2263
+ "@bamboocss/no-hardcoded-color": "warn",
2264
+ "@bamboocss/no-invalid-nesting": "error",
2265
+ "@bamboocss/no-invalid-token-paths": "error",
2266
+ "@bamboocss/no-property-renaming": "warn",
2267
+ "@bamboocss/no-unsafe-token-fn-usage": "warn"
2268
+ }
2269
+ };
2270
+
2271
+ //#endregion
2272
+ //#region src/index.ts
2273
+ const plugin = {
2274
+ configs: {
2275
+ all: all_default,
2276
+ recommended: recommended_default
2277
+ },
2278
+ meta: {
2279
+ name,
2280
+ version
2281
+ },
2282
+ rules
2283
+ };
2284
+ module.exports = plugin;
2285
+
2286
+ //#endregion
2287
+ //# sourceMappingURL=index.cjs.map