@pandacss/eslint-plugin 0.0.10 → 0.0.11
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.js +65 -4
- package/dist/index.mjs +76 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7957,7 +7957,7 @@ init_cjs_shims();
|
|
|
7957
7957
|
|
|
7958
7958
|
// package.json
|
|
7959
7959
|
var name = "@pandacss/eslint-plugin";
|
|
7960
|
-
var version = "0.0.
|
|
7960
|
+
var version = "0.0.11";
|
|
7961
7961
|
|
|
7962
7962
|
// src/configs/all.ts
|
|
7963
7963
|
init_cjs_shims();
|
|
@@ -8390,7 +8390,7 @@ var rule4 = createRule({
|
|
|
8390
8390
|
return;
|
|
8391
8391
|
if (isJSXExpressionContainer(node.value) && isTemplateLiteral(node.value.expression) && node.value.expression.expressions.length === 0)
|
|
8392
8392
|
return;
|
|
8393
|
-
if (isObjectExpression(node.value))
|
|
8393
|
+
if (isObjectExpression(node.value.expression))
|
|
8394
8394
|
return;
|
|
8395
8395
|
if (!isPandaProp(node, context))
|
|
8396
8396
|
return;
|
|
@@ -9114,7 +9114,7 @@ var rule12 = createRule({
|
|
|
9114
9114
|
name: RULE_NAME12,
|
|
9115
9115
|
meta: {
|
|
9116
9116
|
docs: {
|
|
9117
|
-
description: "Encourage the use of atomic properties instead of composite
|
|
9117
|
+
description: "Encourage the use of atomic properties instead of composite properties in the codebase."
|
|
9118
9118
|
},
|
|
9119
9119
|
messages: {
|
|
9120
9120
|
atomic: "Use atomic properties of `{{composite}}` instead. Prefer: \n{{atomics}}"
|
|
@@ -9169,6 +9169,66 @@ var rule12 = createRule({
|
|
|
9169
9169
|
});
|
|
9170
9170
|
var prefer_atomic_properties_default = rule12;
|
|
9171
9171
|
|
|
9172
|
+
// src/rules/prefer-composite-properties.ts
|
|
9173
|
+
init_cjs_shims();
|
|
9174
|
+
var RULE_NAME13 = "prefer-composite-properties";
|
|
9175
|
+
var rule13 = createRule({
|
|
9176
|
+
name: RULE_NAME13,
|
|
9177
|
+
meta: {
|
|
9178
|
+
docs: {
|
|
9179
|
+
description: "Encourage the use of composite properties instead of atomic properties in the codebase."
|
|
9180
|
+
},
|
|
9181
|
+
messages: {
|
|
9182
|
+
composite: "Use composite property of `{{atomic}}` instead. \nPrefer: {{composite}}"
|
|
9183
|
+
},
|
|
9184
|
+
type: "suggestion",
|
|
9185
|
+
schema: []
|
|
9186
|
+
},
|
|
9187
|
+
defaultOptions: [],
|
|
9188
|
+
create(context) {
|
|
9189
|
+
const resolveCompositeProperty = (name2) => {
|
|
9190
|
+
const longhand = resolveLonghand(name2, context) ?? name2;
|
|
9191
|
+
if (!isValidProperty(longhand, context))
|
|
9192
|
+
return;
|
|
9193
|
+
return Object.keys(compositeProperties).find((cpd) => compositeProperties[cpd].includes(longhand));
|
|
9194
|
+
};
|
|
9195
|
+
const sendReport = (node, name2) => {
|
|
9196
|
+
const cmp = resolveCompositeProperty(name2);
|
|
9197
|
+
return context.report({
|
|
9198
|
+
node,
|
|
9199
|
+
messageId: "composite",
|
|
9200
|
+
data: {
|
|
9201
|
+
composite: cmp,
|
|
9202
|
+
atomic: name2
|
|
9203
|
+
}
|
|
9204
|
+
});
|
|
9205
|
+
};
|
|
9206
|
+
return {
|
|
9207
|
+
JSXAttribute(node) {
|
|
9208
|
+
if (!isJSXIdentifier(node.name))
|
|
9209
|
+
return;
|
|
9210
|
+
if (!isPandaProp(node, context))
|
|
9211
|
+
return;
|
|
9212
|
+
const atm = resolveCompositeProperty(node.name.name);
|
|
9213
|
+
if (!atm)
|
|
9214
|
+
return;
|
|
9215
|
+
sendReport(node, node.name.name);
|
|
9216
|
+
},
|
|
9217
|
+
Property(node) {
|
|
9218
|
+
if (!isIdentifier(node.key))
|
|
9219
|
+
return;
|
|
9220
|
+
if (!isPandaAttribute(node, context))
|
|
9221
|
+
return;
|
|
9222
|
+
const atm = resolveCompositeProperty(node.key.name);
|
|
9223
|
+
if (!atm)
|
|
9224
|
+
return;
|
|
9225
|
+
sendReport(node.key, node.key.name);
|
|
9226
|
+
}
|
|
9227
|
+
};
|
|
9228
|
+
}
|
|
9229
|
+
});
|
|
9230
|
+
var prefer_composite_properties_default = rule13;
|
|
9231
|
+
|
|
9172
9232
|
// src/rules/index.ts
|
|
9173
9233
|
var rules = {
|
|
9174
9234
|
[RULE_NAME]: file_not_included_default,
|
|
@@ -9182,7 +9242,8 @@ var rules = {
|
|
|
9182
9242
|
[RULE_NAME9]: prefer_longhand_properties_default,
|
|
9183
9243
|
[RULE_NAME10]: prefer_shorthand_properties_default,
|
|
9184
9244
|
[RULE_NAME11]: no_unsafe_token_fn_usage_default,
|
|
9185
|
-
[RULE_NAME12]: prefer_atomic_properties_default
|
|
9245
|
+
[RULE_NAME12]: prefer_atomic_properties_default,
|
|
9246
|
+
[RULE_NAME13]: prefer_composite_properties_default
|
|
9186
9247
|
};
|
|
9187
9248
|
|
|
9188
9249
|
// src/configs/all.ts
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ var name, version;
|
|
|
10
10
|
var init_package = __esm({
|
|
11
11
|
"package.json"() {
|
|
12
12
|
name = "@pandacss/eslint-plugin";
|
|
13
|
-
version = "0.0.
|
|
13
|
+
version = "0.0.11";
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -8402,7 +8402,7 @@ var init_no_dynamic_styling = __esm({
|
|
|
8402
8402
|
return;
|
|
8403
8403
|
if (isJSXExpressionContainer(node.value) && isTemplateLiteral(node.value.expression) && node.value.expression.expressions.length === 0)
|
|
8404
8404
|
return;
|
|
8405
|
-
if (isObjectExpression(node.value))
|
|
8405
|
+
if (isObjectExpression(node.value.expression))
|
|
8406
8406
|
return;
|
|
8407
8407
|
if (!isPandaProp(node, context))
|
|
8408
8408
|
return;
|
|
@@ -9203,7 +9203,7 @@ var init_prefer_atomic_properties = __esm({
|
|
|
9203
9203
|
name: RULE_NAME12,
|
|
9204
9204
|
meta: {
|
|
9205
9205
|
docs: {
|
|
9206
|
-
description: "Encourage the use of atomic properties instead of composite
|
|
9206
|
+
description: "Encourage the use of atomic properties instead of composite properties in the codebase."
|
|
9207
9207
|
},
|
|
9208
9208
|
messages: {
|
|
9209
9209
|
atomic: "Use atomic properties of `{{composite}}` instead. Prefer: \n{{atomics}}"
|
|
@@ -9260,6 +9260,76 @@ var init_prefer_atomic_properties = __esm({
|
|
|
9260
9260
|
}
|
|
9261
9261
|
});
|
|
9262
9262
|
|
|
9263
|
+
// src/rules/prefer-composite-properties.ts
|
|
9264
|
+
var RULE_NAME13, rule13, prefer_composite_properties_default;
|
|
9265
|
+
var init_prefer_composite_properties = __esm({
|
|
9266
|
+
"src/rules/prefer-composite-properties.ts"() {
|
|
9267
|
+
"use strict";
|
|
9268
|
+
init_esm_shims();
|
|
9269
|
+
init_helpers();
|
|
9270
|
+
init_utils();
|
|
9271
|
+
init_composite_properties();
|
|
9272
|
+
init_nodes();
|
|
9273
|
+
RULE_NAME13 = "prefer-composite-properties";
|
|
9274
|
+
rule13 = createRule({
|
|
9275
|
+
name: RULE_NAME13,
|
|
9276
|
+
meta: {
|
|
9277
|
+
docs: {
|
|
9278
|
+
description: "Encourage the use of composite properties instead of atomic properties in the codebase."
|
|
9279
|
+
},
|
|
9280
|
+
messages: {
|
|
9281
|
+
composite: "Use composite property of `{{atomic}}` instead. \nPrefer: {{composite}}"
|
|
9282
|
+
},
|
|
9283
|
+
type: "suggestion",
|
|
9284
|
+
schema: []
|
|
9285
|
+
},
|
|
9286
|
+
defaultOptions: [],
|
|
9287
|
+
create(context) {
|
|
9288
|
+
const resolveCompositeProperty = (name2) => {
|
|
9289
|
+
const longhand = resolveLonghand(name2, context) ?? name2;
|
|
9290
|
+
if (!isValidProperty(longhand, context))
|
|
9291
|
+
return;
|
|
9292
|
+
return Object.keys(compositeProperties).find((cpd) => compositeProperties[cpd].includes(longhand));
|
|
9293
|
+
};
|
|
9294
|
+
const sendReport = (node, name2) => {
|
|
9295
|
+
const cmp = resolveCompositeProperty(name2);
|
|
9296
|
+
return context.report({
|
|
9297
|
+
node,
|
|
9298
|
+
messageId: "composite",
|
|
9299
|
+
data: {
|
|
9300
|
+
composite: cmp,
|
|
9301
|
+
atomic: name2
|
|
9302
|
+
}
|
|
9303
|
+
});
|
|
9304
|
+
};
|
|
9305
|
+
return {
|
|
9306
|
+
JSXAttribute(node) {
|
|
9307
|
+
if (!isJSXIdentifier(node.name))
|
|
9308
|
+
return;
|
|
9309
|
+
if (!isPandaProp(node, context))
|
|
9310
|
+
return;
|
|
9311
|
+
const atm = resolveCompositeProperty(node.name.name);
|
|
9312
|
+
if (!atm)
|
|
9313
|
+
return;
|
|
9314
|
+
sendReport(node, node.name.name);
|
|
9315
|
+
},
|
|
9316
|
+
Property(node) {
|
|
9317
|
+
if (!isIdentifier(node.key))
|
|
9318
|
+
return;
|
|
9319
|
+
if (!isPandaAttribute(node, context))
|
|
9320
|
+
return;
|
|
9321
|
+
const atm = resolveCompositeProperty(node.key.name);
|
|
9322
|
+
if (!atm)
|
|
9323
|
+
return;
|
|
9324
|
+
sendReport(node.key, node.key.name);
|
|
9325
|
+
}
|
|
9326
|
+
};
|
|
9327
|
+
}
|
|
9328
|
+
});
|
|
9329
|
+
prefer_composite_properties_default = rule13;
|
|
9330
|
+
}
|
|
9331
|
+
});
|
|
9332
|
+
|
|
9263
9333
|
// src/rules/index.ts
|
|
9264
9334
|
var rules;
|
|
9265
9335
|
var init_rules = __esm({
|
|
@@ -9278,6 +9348,7 @@ var init_rules = __esm({
|
|
|
9278
9348
|
init_prefer_shorthand_properties();
|
|
9279
9349
|
init_no_unsafe_token_fn_usage();
|
|
9280
9350
|
init_prefer_atomic_properties();
|
|
9351
|
+
init_prefer_composite_properties();
|
|
9281
9352
|
rules = {
|
|
9282
9353
|
[RULE_NAME]: file_not_included_default,
|
|
9283
9354
|
[RULE_NAME2]: no_config_function_in_source_default,
|
|
@@ -9290,7 +9361,8 @@ var init_rules = __esm({
|
|
|
9290
9361
|
[RULE_NAME9]: prefer_longhand_properties_default,
|
|
9291
9362
|
[RULE_NAME10]: prefer_shorthand_properties_default,
|
|
9292
9363
|
[RULE_NAME11]: no_unsafe_token_fn_usage_default,
|
|
9293
|
-
[RULE_NAME12]: prefer_atomic_properties_default
|
|
9364
|
+
[RULE_NAME12]: prefer_atomic_properties_default,
|
|
9365
|
+
[RULE_NAME13]: prefer_composite_properties_default
|
|
9294
9366
|
};
|
|
9295
9367
|
}
|
|
9296
9368
|
});
|