@pandacss/eslint-plugin 0.2.8 → 0.2.9
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 +124 -74
- package/dist/index.mjs +126 -76
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7884,7 +7884,7 @@ init_cjs_shims();
|
|
|
7884
7884
|
|
|
7885
7885
|
// package.json
|
|
7886
7886
|
var name = "@pandacss/eslint-plugin";
|
|
7887
|
-
var version = "0.2.
|
|
7887
|
+
var version = "0.2.9";
|
|
7888
7888
|
|
|
7889
7889
|
// src/configs/all.ts
|
|
7890
7890
|
init_cjs_shims();
|
|
@@ -9086,19 +9086,112 @@ var physicalProperties = {
|
|
|
9086
9086
|
top: "insetBlockStart",
|
|
9087
9087
|
bottom: "insetBlockEnd"
|
|
9088
9088
|
};
|
|
9089
|
+
var physicalPropertyValues = {
|
|
9090
|
+
// text-align physical values mapped to logical values
|
|
9091
|
+
textAlign: {
|
|
9092
|
+
left: "start",
|
|
9093
|
+
right: "end"
|
|
9094
|
+
}
|
|
9095
|
+
};
|
|
9089
9096
|
|
|
9090
9097
|
// src/rules/no-physical-properties.ts
|
|
9091
9098
|
var RULE_NAME11 = "no-physical-properties";
|
|
9099
|
+
var MESSAGES = {
|
|
9100
|
+
physical: "Use logical property instead of {{physical}}. Prefer `{{logical}}`.",
|
|
9101
|
+
physicalValue: "Use logical value instead of {{physical}}. Prefer `{{logical}}`.",
|
|
9102
|
+
replace: "Replace `{{physical}}` with `{{logical}}`."
|
|
9103
|
+
};
|
|
9104
|
+
var PropertyCache = class {
|
|
9105
|
+
longhandCache = /* @__PURE__ */ new Map();
|
|
9106
|
+
pandaPropCache = /* @__PURE__ */ new WeakMap();
|
|
9107
|
+
pandaAttributeCache = /* @__PURE__ */ new WeakMap();
|
|
9108
|
+
recipeVariantCache = /* @__PURE__ */ new WeakMap();
|
|
9109
|
+
getLonghand(name2, context) {
|
|
9110
|
+
if (this.longhandCache.has(name2)) {
|
|
9111
|
+
return this.longhandCache.get(name2);
|
|
9112
|
+
}
|
|
9113
|
+
const longhand = resolveLonghand(name2, context) ?? name2;
|
|
9114
|
+
this.longhandCache.set(name2, longhand);
|
|
9115
|
+
return longhand;
|
|
9116
|
+
}
|
|
9117
|
+
isPandaProp(node, context) {
|
|
9118
|
+
if (this.pandaPropCache.has(node)) {
|
|
9119
|
+
return this.pandaPropCache.get(node);
|
|
9120
|
+
}
|
|
9121
|
+
const result = isPandaProp(node, context);
|
|
9122
|
+
this.pandaPropCache.set(node, result);
|
|
9123
|
+
return !!result;
|
|
9124
|
+
}
|
|
9125
|
+
isPandaAttribute(node, context) {
|
|
9126
|
+
if (this.pandaAttributeCache.has(node)) {
|
|
9127
|
+
return this.pandaAttributeCache.get(node);
|
|
9128
|
+
}
|
|
9129
|
+
const result = isPandaAttribute(node, context);
|
|
9130
|
+
this.pandaAttributeCache.set(node, result);
|
|
9131
|
+
return !!result;
|
|
9132
|
+
}
|
|
9133
|
+
isRecipeVariant(node, context) {
|
|
9134
|
+
if (this.recipeVariantCache.has(node)) {
|
|
9135
|
+
return this.recipeVariantCache.get(node);
|
|
9136
|
+
}
|
|
9137
|
+
const result = isRecipeVariant(node, context);
|
|
9138
|
+
this.recipeVariantCache.set(node, result);
|
|
9139
|
+
return !!result;
|
|
9140
|
+
}
|
|
9141
|
+
};
|
|
9142
|
+
var extractStringLiteralValue = (valueNode) => {
|
|
9143
|
+
if (isLiteral(valueNode) && typeof valueNode.value === "string") {
|
|
9144
|
+
return valueNode.value;
|
|
9145
|
+
}
|
|
9146
|
+
if (isJSXExpressionContainer(valueNode) && isLiteral(valueNode.expression) && typeof valueNode.expression.value === "string") {
|
|
9147
|
+
return valueNode.expression.value;
|
|
9148
|
+
}
|
|
9149
|
+
return null;
|
|
9150
|
+
};
|
|
9151
|
+
var createPropertyReport = (node, longhandName, logical, context) => {
|
|
9152
|
+
const physicalName = `\`${node.name}\`${longhandName !== node.name ? ` (resolved to \`${longhandName}\`)` : ""}`;
|
|
9153
|
+
context.report({
|
|
9154
|
+
node,
|
|
9155
|
+
messageId: "physical",
|
|
9156
|
+
data: { physical: physicalName, logical },
|
|
9157
|
+
suggest: [
|
|
9158
|
+
{
|
|
9159
|
+
messageId: "replace",
|
|
9160
|
+
data: { physical: node.name, logical },
|
|
9161
|
+
fix: (fixer) => fixer.replaceText(node, logical)
|
|
9162
|
+
}
|
|
9163
|
+
]
|
|
9164
|
+
});
|
|
9165
|
+
};
|
|
9166
|
+
var createValueReport = (valueNode, valueText, logical, context) => {
|
|
9167
|
+
context.report({
|
|
9168
|
+
node: valueNode,
|
|
9169
|
+
messageId: "physicalValue",
|
|
9170
|
+
data: { physical: `"${valueText}"`, logical: `"${logical}"` },
|
|
9171
|
+
suggest: [
|
|
9172
|
+
{
|
|
9173
|
+
messageId: "replace",
|
|
9174
|
+
data: { physical: `"${valueText}"`, logical: `"${logical}"` },
|
|
9175
|
+
fix: (fixer) => {
|
|
9176
|
+
if (isLiteral(valueNode)) {
|
|
9177
|
+
return fixer.replaceText(valueNode, `"${logical}"`);
|
|
9178
|
+
}
|
|
9179
|
+
if (isJSXExpressionContainer(valueNode) && isLiteral(valueNode.expression)) {
|
|
9180
|
+
return fixer.replaceText(valueNode.expression, `"${logical}"`);
|
|
9181
|
+
}
|
|
9182
|
+
return null;
|
|
9183
|
+
}
|
|
9184
|
+
}
|
|
9185
|
+
]
|
|
9186
|
+
});
|
|
9187
|
+
};
|
|
9092
9188
|
var rule11 = createRule({
|
|
9093
9189
|
name: RULE_NAME11,
|
|
9094
9190
|
meta: {
|
|
9095
9191
|
docs: {
|
|
9096
9192
|
description: "Encourage the use of logical properties over physical properties to foster a responsive and adaptable user interface."
|
|
9097
9193
|
},
|
|
9098
|
-
messages:
|
|
9099
|
-
physical: "Use logical property instead of {{physical}}. Prefer `{{logical}}`.",
|
|
9100
|
-
replace: "Replace `{{physical}}` with `{{logical}}`."
|
|
9101
|
-
},
|
|
9194
|
+
messages: MESSAGES,
|
|
9102
9195
|
type: "suggestion",
|
|
9103
9196
|
hasSuggestions: true,
|
|
9104
9197
|
schema: [
|
|
@@ -9118,87 +9211,44 @@ var rule11 = createRule({
|
|
|
9118
9211
|
}
|
|
9119
9212
|
]
|
|
9120
9213
|
},
|
|
9121
|
-
defaultOptions: [
|
|
9122
|
-
{
|
|
9123
|
-
whitelist: []
|
|
9124
|
-
}
|
|
9125
|
-
],
|
|
9214
|
+
defaultOptions: [{ whitelist: [] }],
|
|
9126
9215
|
create(context) {
|
|
9127
9216
|
const whitelist = context.options[0]?.whitelist ?? [];
|
|
9128
|
-
const
|
|
9129
|
-
const
|
|
9130
|
-
const pandaAttributeCache = /* @__PURE__ */ new WeakMap();
|
|
9131
|
-
const recipeVariantCache = /* @__PURE__ */ new WeakMap();
|
|
9132
|
-
const getLonghand = (name2) => {
|
|
9133
|
-
if (longhandCache.has(name2)) {
|
|
9134
|
-
return longhandCache.get(name2);
|
|
9135
|
-
}
|
|
9136
|
-
const longhand = resolveLonghand(name2, context) ?? name2;
|
|
9137
|
-
longhandCache.set(name2, longhand);
|
|
9138
|
-
return longhand;
|
|
9139
|
-
};
|
|
9140
|
-
const isCachedPandaProp = (node) => {
|
|
9141
|
-
if (pandaPropCache.has(node)) {
|
|
9142
|
-
return pandaPropCache.get(node);
|
|
9143
|
-
}
|
|
9144
|
-
const result = isPandaProp(node, context);
|
|
9145
|
-
pandaPropCache.set(node, result);
|
|
9146
|
-
return !!result;
|
|
9147
|
-
};
|
|
9148
|
-
const isCachedPandaAttribute = (node) => {
|
|
9149
|
-
if (pandaAttributeCache.has(node)) {
|
|
9150
|
-
return pandaAttributeCache.get(node);
|
|
9151
|
-
}
|
|
9152
|
-
const result = isPandaAttribute(node, context);
|
|
9153
|
-
pandaAttributeCache.set(node, result);
|
|
9154
|
-
return !!result;
|
|
9155
|
-
};
|
|
9156
|
-
const isCachedRecipeVariant = (node) => {
|
|
9157
|
-
if (recipeVariantCache.has(node)) {
|
|
9158
|
-
return recipeVariantCache.get(node);
|
|
9159
|
-
}
|
|
9160
|
-
const result = isRecipeVariant(node, context);
|
|
9161
|
-
recipeVariantCache.set(node, result);
|
|
9162
|
-
return !!result;
|
|
9163
|
-
};
|
|
9164
|
-
const sendReport = (node) => {
|
|
9217
|
+
const cache = new PropertyCache();
|
|
9218
|
+
const checkPropertyName = (node) => {
|
|
9165
9219
|
if (whitelist.includes(node.name)) return;
|
|
9166
|
-
const longhandName = getLonghand(node.name);
|
|
9220
|
+
const longhandName = cache.getLonghand(node.name, context);
|
|
9167
9221
|
if (!(longhandName in physicalProperties)) return;
|
|
9168
9222
|
const logical = physicalProperties[longhandName];
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
data: {
|
|
9181
|
-
physical: node.name,
|
|
9182
|
-
logical
|
|
9183
|
-
},
|
|
9184
|
-
fix: (fixer) => {
|
|
9185
|
-
return fixer.replaceText(node, logical);
|
|
9186
|
-
}
|
|
9187
|
-
}
|
|
9188
|
-
]
|
|
9189
|
-
});
|
|
9223
|
+
createPropertyReport(node, longhandName, logical, context);
|
|
9224
|
+
};
|
|
9225
|
+
const checkPropertyValue = (keyNode, valueNode) => {
|
|
9226
|
+
const propName = keyNode.name;
|
|
9227
|
+
if (!(propName in physicalPropertyValues)) return false;
|
|
9228
|
+
const valueText = extractStringLiteralValue(valueNode);
|
|
9229
|
+
if (valueText === null) return false;
|
|
9230
|
+
const valueMap = physicalPropertyValues[propName];
|
|
9231
|
+
if (!valueMap[valueText]) return false;
|
|
9232
|
+
createValueReport(valueNode, valueText, valueMap[valueText], context);
|
|
9233
|
+
return true;
|
|
9190
9234
|
};
|
|
9191
9235
|
return {
|
|
9192
9236
|
JSXAttribute(node) {
|
|
9193
9237
|
if (!isJSXIdentifier(node.name)) return;
|
|
9194
|
-
if (!
|
|
9195
|
-
|
|
9238
|
+
if (!cache.isPandaProp(node, context)) return;
|
|
9239
|
+
checkPropertyName(node.name);
|
|
9240
|
+
if (node.value) {
|
|
9241
|
+
checkPropertyValue(node.name, node.value);
|
|
9242
|
+
}
|
|
9196
9243
|
},
|
|
9197
9244
|
Property(node) {
|
|
9198
9245
|
if (!isIdentifier(node.key)) return;
|
|
9199
|
-
if (!
|
|
9200
|
-
if (
|
|
9201
|
-
|
|
9246
|
+
if (!cache.isPandaAttribute(node, context)) return;
|
|
9247
|
+
if (cache.isRecipeVariant(node, context)) return;
|
|
9248
|
+
checkPropertyName(node.key);
|
|
9249
|
+
if (node.value) {
|
|
9250
|
+
checkPropertyValue(node.key, node.value);
|
|
9251
|
+
}
|
|
9202
9252
|
}
|
|
9203
9253
|
};
|
|
9204
9254
|
}
|
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.2.
|
|
13
|
+
version = "0.2.9";
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -9115,7 +9115,7 @@ var init_no_margin_properties = __esm({
|
|
|
9115
9115
|
});
|
|
9116
9116
|
|
|
9117
9117
|
// src/utils/physical-properties.ts
|
|
9118
|
-
var physicalProperties;
|
|
9118
|
+
var physicalProperties, physicalPropertyValues;
|
|
9119
9119
|
var init_physical_properties = __esm({
|
|
9120
9120
|
"src/utils/physical-properties.ts"() {
|
|
9121
9121
|
"use strict";
|
|
@@ -9154,11 +9154,18 @@ var init_physical_properties = __esm({
|
|
|
9154
9154
|
top: "insetBlockStart",
|
|
9155
9155
|
bottom: "insetBlockEnd"
|
|
9156
9156
|
};
|
|
9157
|
+
physicalPropertyValues = {
|
|
9158
|
+
// text-align physical values mapped to logical values
|
|
9159
|
+
textAlign: {
|
|
9160
|
+
left: "start",
|
|
9161
|
+
right: "end"
|
|
9162
|
+
}
|
|
9163
|
+
};
|
|
9157
9164
|
}
|
|
9158
9165
|
});
|
|
9159
9166
|
|
|
9160
9167
|
// src/rules/no-physical-properties.ts
|
|
9161
|
-
var RULE_NAME11, rule11, no_physical_properties_default;
|
|
9168
|
+
var RULE_NAME11, MESSAGES, PropertyCache, extractStringLiteralValue, createPropertyReport, createValueReport, rule11, no_physical_properties_default;
|
|
9162
9169
|
var init_no_physical_properties = __esm({
|
|
9163
9170
|
"src/rules/no-physical-properties.ts"() {
|
|
9164
9171
|
"use strict";
|
|
@@ -9168,16 +9175,102 @@ var init_no_physical_properties = __esm({
|
|
|
9168
9175
|
init_nodes();
|
|
9169
9176
|
init_physical_properties();
|
|
9170
9177
|
RULE_NAME11 = "no-physical-properties";
|
|
9178
|
+
MESSAGES = {
|
|
9179
|
+
physical: "Use logical property instead of {{physical}}. Prefer `{{logical}}`.",
|
|
9180
|
+
physicalValue: "Use logical value instead of {{physical}}. Prefer `{{logical}}`.",
|
|
9181
|
+
replace: "Replace `{{physical}}` with `{{logical}}`."
|
|
9182
|
+
};
|
|
9183
|
+
PropertyCache = class {
|
|
9184
|
+
longhandCache = /* @__PURE__ */ new Map();
|
|
9185
|
+
pandaPropCache = /* @__PURE__ */ new WeakMap();
|
|
9186
|
+
pandaAttributeCache = /* @__PURE__ */ new WeakMap();
|
|
9187
|
+
recipeVariantCache = /* @__PURE__ */ new WeakMap();
|
|
9188
|
+
getLonghand(name2, context) {
|
|
9189
|
+
if (this.longhandCache.has(name2)) {
|
|
9190
|
+
return this.longhandCache.get(name2);
|
|
9191
|
+
}
|
|
9192
|
+
const longhand = resolveLonghand(name2, context) ?? name2;
|
|
9193
|
+
this.longhandCache.set(name2, longhand);
|
|
9194
|
+
return longhand;
|
|
9195
|
+
}
|
|
9196
|
+
isPandaProp(node, context) {
|
|
9197
|
+
if (this.pandaPropCache.has(node)) {
|
|
9198
|
+
return this.pandaPropCache.get(node);
|
|
9199
|
+
}
|
|
9200
|
+
const result = isPandaProp(node, context);
|
|
9201
|
+
this.pandaPropCache.set(node, result);
|
|
9202
|
+
return !!result;
|
|
9203
|
+
}
|
|
9204
|
+
isPandaAttribute(node, context) {
|
|
9205
|
+
if (this.pandaAttributeCache.has(node)) {
|
|
9206
|
+
return this.pandaAttributeCache.get(node);
|
|
9207
|
+
}
|
|
9208
|
+
const result = isPandaAttribute(node, context);
|
|
9209
|
+
this.pandaAttributeCache.set(node, result);
|
|
9210
|
+
return !!result;
|
|
9211
|
+
}
|
|
9212
|
+
isRecipeVariant(node, context) {
|
|
9213
|
+
if (this.recipeVariantCache.has(node)) {
|
|
9214
|
+
return this.recipeVariantCache.get(node);
|
|
9215
|
+
}
|
|
9216
|
+
const result = isRecipeVariant(node, context);
|
|
9217
|
+
this.recipeVariantCache.set(node, result);
|
|
9218
|
+
return !!result;
|
|
9219
|
+
}
|
|
9220
|
+
};
|
|
9221
|
+
extractStringLiteralValue = (valueNode) => {
|
|
9222
|
+
if (isLiteral(valueNode) && typeof valueNode.value === "string") {
|
|
9223
|
+
return valueNode.value;
|
|
9224
|
+
}
|
|
9225
|
+
if (isJSXExpressionContainer(valueNode) && isLiteral(valueNode.expression) && typeof valueNode.expression.value === "string") {
|
|
9226
|
+
return valueNode.expression.value;
|
|
9227
|
+
}
|
|
9228
|
+
return null;
|
|
9229
|
+
};
|
|
9230
|
+
createPropertyReport = (node, longhandName, logical, context) => {
|
|
9231
|
+
const physicalName = `\`${node.name}\`${longhandName !== node.name ? ` (resolved to \`${longhandName}\`)` : ""}`;
|
|
9232
|
+
context.report({
|
|
9233
|
+
node,
|
|
9234
|
+
messageId: "physical",
|
|
9235
|
+
data: { physical: physicalName, logical },
|
|
9236
|
+
suggest: [
|
|
9237
|
+
{
|
|
9238
|
+
messageId: "replace",
|
|
9239
|
+
data: { physical: node.name, logical },
|
|
9240
|
+
fix: (fixer) => fixer.replaceText(node, logical)
|
|
9241
|
+
}
|
|
9242
|
+
]
|
|
9243
|
+
});
|
|
9244
|
+
};
|
|
9245
|
+
createValueReport = (valueNode, valueText, logical, context) => {
|
|
9246
|
+
context.report({
|
|
9247
|
+
node: valueNode,
|
|
9248
|
+
messageId: "physicalValue",
|
|
9249
|
+
data: { physical: `"${valueText}"`, logical: `"${logical}"` },
|
|
9250
|
+
suggest: [
|
|
9251
|
+
{
|
|
9252
|
+
messageId: "replace",
|
|
9253
|
+
data: { physical: `"${valueText}"`, logical: `"${logical}"` },
|
|
9254
|
+
fix: (fixer) => {
|
|
9255
|
+
if (isLiteral(valueNode)) {
|
|
9256
|
+
return fixer.replaceText(valueNode, `"${logical}"`);
|
|
9257
|
+
}
|
|
9258
|
+
if (isJSXExpressionContainer(valueNode) && isLiteral(valueNode.expression)) {
|
|
9259
|
+
return fixer.replaceText(valueNode.expression, `"${logical}"`);
|
|
9260
|
+
}
|
|
9261
|
+
return null;
|
|
9262
|
+
}
|
|
9263
|
+
}
|
|
9264
|
+
]
|
|
9265
|
+
});
|
|
9266
|
+
};
|
|
9171
9267
|
rule11 = createRule({
|
|
9172
9268
|
name: RULE_NAME11,
|
|
9173
9269
|
meta: {
|
|
9174
9270
|
docs: {
|
|
9175
9271
|
description: "Encourage the use of logical properties over physical properties to foster a responsive and adaptable user interface."
|
|
9176
9272
|
},
|
|
9177
|
-
messages:
|
|
9178
|
-
physical: "Use logical property instead of {{physical}}. Prefer `{{logical}}`.",
|
|
9179
|
-
replace: "Replace `{{physical}}` with `{{logical}}`."
|
|
9180
|
-
},
|
|
9273
|
+
messages: MESSAGES,
|
|
9181
9274
|
type: "suggestion",
|
|
9182
9275
|
hasSuggestions: true,
|
|
9183
9276
|
schema: [
|
|
@@ -9197,87 +9290,44 @@ var init_no_physical_properties = __esm({
|
|
|
9197
9290
|
}
|
|
9198
9291
|
]
|
|
9199
9292
|
},
|
|
9200
|
-
defaultOptions: [
|
|
9201
|
-
{
|
|
9202
|
-
whitelist: []
|
|
9203
|
-
}
|
|
9204
|
-
],
|
|
9293
|
+
defaultOptions: [{ whitelist: [] }],
|
|
9205
9294
|
create(context) {
|
|
9206
9295
|
const whitelist = context.options[0]?.whitelist ?? [];
|
|
9207
|
-
const
|
|
9208
|
-
const
|
|
9209
|
-
const pandaAttributeCache = /* @__PURE__ */ new WeakMap();
|
|
9210
|
-
const recipeVariantCache = /* @__PURE__ */ new WeakMap();
|
|
9211
|
-
const getLonghand = (name2) => {
|
|
9212
|
-
if (longhandCache.has(name2)) {
|
|
9213
|
-
return longhandCache.get(name2);
|
|
9214
|
-
}
|
|
9215
|
-
const longhand = resolveLonghand(name2, context) ?? name2;
|
|
9216
|
-
longhandCache.set(name2, longhand);
|
|
9217
|
-
return longhand;
|
|
9218
|
-
};
|
|
9219
|
-
const isCachedPandaProp = (node) => {
|
|
9220
|
-
if (pandaPropCache.has(node)) {
|
|
9221
|
-
return pandaPropCache.get(node);
|
|
9222
|
-
}
|
|
9223
|
-
const result = isPandaProp(node, context);
|
|
9224
|
-
pandaPropCache.set(node, result);
|
|
9225
|
-
return !!result;
|
|
9226
|
-
};
|
|
9227
|
-
const isCachedPandaAttribute = (node) => {
|
|
9228
|
-
if (pandaAttributeCache.has(node)) {
|
|
9229
|
-
return pandaAttributeCache.get(node);
|
|
9230
|
-
}
|
|
9231
|
-
const result = isPandaAttribute(node, context);
|
|
9232
|
-
pandaAttributeCache.set(node, result);
|
|
9233
|
-
return !!result;
|
|
9234
|
-
};
|
|
9235
|
-
const isCachedRecipeVariant = (node) => {
|
|
9236
|
-
if (recipeVariantCache.has(node)) {
|
|
9237
|
-
return recipeVariantCache.get(node);
|
|
9238
|
-
}
|
|
9239
|
-
const result = isRecipeVariant(node, context);
|
|
9240
|
-
recipeVariantCache.set(node, result);
|
|
9241
|
-
return !!result;
|
|
9242
|
-
};
|
|
9243
|
-
const sendReport = (node) => {
|
|
9296
|
+
const cache = new PropertyCache();
|
|
9297
|
+
const checkPropertyName = (node) => {
|
|
9244
9298
|
if (whitelist.includes(node.name)) return;
|
|
9245
|
-
const longhandName = getLonghand(node.name);
|
|
9299
|
+
const longhandName = cache.getLonghand(node.name, context);
|
|
9246
9300
|
if (!(longhandName in physicalProperties)) return;
|
|
9247
9301
|
const logical = physicalProperties[longhandName];
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
data: {
|
|
9260
|
-
physical: node.name,
|
|
9261
|
-
logical
|
|
9262
|
-
},
|
|
9263
|
-
fix: (fixer) => {
|
|
9264
|
-
return fixer.replaceText(node, logical);
|
|
9265
|
-
}
|
|
9266
|
-
}
|
|
9267
|
-
]
|
|
9268
|
-
});
|
|
9302
|
+
createPropertyReport(node, longhandName, logical, context);
|
|
9303
|
+
};
|
|
9304
|
+
const checkPropertyValue = (keyNode, valueNode) => {
|
|
9305
|
+
const propName = keyNode.name;
|
|
9306
|
+
if (!(propName in physicalPropertyValues)) return false;
|
|
9307
|
+
const valueText = extractStringLiteralValue(valueNode);
|
|
9308
|
+
if (valueText === null) return false;
|
|
9309
|
+
const valueMap = physicalPropertyValues[propName];
|
|
9310
|
+
if (!valueMap[valueText]) return false;
|
|
9311
|
+
createValueReport(valueNode, valueText, valueMap[valueText], context);
|
|
9312
|
+
return true;
|
|
9269
9313
|
};
|
|
9270
9314
|
return {
|
|
9271
9315
|
JSXAttribute(node) {
|
|
9272
9316
|
if (!isJSXIdentifier(node.name)) return;
|
|
9273
|
-
if (!
|
|
9274
|
-
|
|
9317
|
+
if (!cache.isPandaProp(node, context)) return;
|
|
9318
|
+
checkPropertyName(node.name);
|
|
9319
|
+
if (node.value) {
|
|
9320
|
+
checkPropertyValue(node.name, node.value);
|
|
9321
|
+
}
|
|
9275
9322
|
},
|
|
9276
9323
|
Property(node) {
|
|
9277
9324
|
if (!isIdentifier(node.key)) return;
|
|
9278
|
-
if (!
|
|
9279
|
-
if (
|
|
9280
|
-
|
|
9325
|
+
if (!cache.isPandaAttribute(node, context)) return;
|
|
9326
|
+
if (cache.isRecipeVariant(node, context)) return;
|
|
9327
|
+
checkPropertyName(node.key);
|
|
9328
|
+
if (node.value) {
|
|
9329
|
+
checkPropertyValue(node.key, node.value);
|
|
9330
|
+
}
|
|
9281
9331
|
}
|
|
9282
9332
|
};
|
|
9283
9333
|
}
|