@pandacss/eslint-plugin 0.0.8 → 0.0.10
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/{chunk-6BVJTDXV.mjs → chunk-HALLAYDZ.mjs} +2 -2
- package/dist/index.js +97 -27
- package/dist/index.mjs +117 -37
- package/dist/utils/worker.js +215 -122
- package/dist/utils/worker.mjs +216 -123
- package/package.json +5 -5
|
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
mod
|
|
28
28
|
));
|
|
29
29
|
|
|
30
|
-
// ../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.
|
|
30
|
+
// ../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.34_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
|
|
31
31
|
var init_esm_shims = __esm({
|
|
32
|
-
"../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.
|
|
32
|
+
"../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.34_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js"() {
|
|
33
33
|
"use strict";
|
|
34
34
|
}
|
|
35
35
|
});
|
package/dist/index.js
CHANGED
|
@@ -28,10 +28,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
mod
|
|
29
29
|
));
|
|
30
30
|
|
|
31
|
-
// ../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.
|
|
31
|
+
// ../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.34_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js
|
|
32
32
|
var getImportMetaUrl, importMetaUrl;
|
|
33
33
|
var init_cjs_shims = __esm({
|
|
34
|
-
"../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.
|
|
34
|
+
"../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.34_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"() {
|
|
35
35
|
"use strict";
|
|
36
36
|
getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
37
37
|
importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
@@ -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.10";
|
|
7961
7961
|
|
|
7962
7962
|
// src/configs/all.ts
|
|
7963
7963
|
init_cjs_shims();
|
|
@@ -8161,8 +8161,8 @@ var isPandaAttribute = (node, context) => {
|
|
|
8161
8161
|
var resolveLonghand = (name2, context) => {
|
|
8162
8162
|
return syncAction("resolveLongHand", getSyncOpts(context), name2);
|
|
8163
8163
|
};
|
|
8164
|
-
var
|
|
8165
|
-
return syncAction("
|
|
8164
|
+
var resolveShorthands = (name2, context) => {
|
|
8165
|
+
return syncAction("resolveShorthands", getSyncOpts(context), name2);
|
|
8166
8166
|
};
|
|
8167
8167
|
var isColorAttribute = (attr, context) => {
|
|
8168
8168
|
return syncAction("isColorAttribute", getSyncOpts(context), attr);
|
|
@@ -8192,7 +8192,7 @@ var getInvalidTokens = (value, context) => {
|
|
|
8192
8192
|
const tokens = extractTokens(value);
|
|
8193
8193
|
if (!tokens.length)
|
|
8194
8194
|
return [];
|
|
8195
|
-
return syncAction("
|
|
8195
|
+
return syncAction("filterInvalidTokens", getSyncOpts(context), tokens);
|
|
8196
8196
|
};
|
|
8197
8197
|
var getTokenImport = (context) => {
|
|
8198
8198
|
const imports = _getImports(context);
|
|
@@ -8753,14 +8753,14 @@ var rule8 = createRule({
|
|
|
8753
8753
|
});
|
|
8754
8754
|
var no_property_renaming_default = rule8;
|
|
8755
8755
|
|
|
8756
|
-
// src/rules/
|
|
8756
|
+
// src/rules/prefer-longhand-properties.ts
|
|
8757
8757
|
init_cjs_shims();
|
|
8758
|
-
var RULE_NAME9 = "
|
|
8758
|
+
var RULE_NAME9 = "prefer-longhand-properties";
|
|
8759
8759
|
var rule9 = createRule({
|
|
8760
8760
|
name: RULE_NAME9,
|
|
8761
8761
|
meta: {
|
|
8762
8762
|
docs: {
|
|
8763
|
-
description: "Discourage the use of shorthand properties and promote the preference for longhand
|
|
8763
|
+
description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
|
|
8764
8764
|
},
|
|
8765
8765
|
messages: {
|
|
8766
8766
|
longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`",
|
|
@@ -8817,14 +8817,83 @@ var rule9 = createRule({
|
|
|
8817
8817
|
};
|
|
8818
8818
|
}
|
|
8819
8819
|
});
|
|
8820
|
-
var
|
|
8820
|
+
var prefer_longhand_properties_default = rule9;
|
|
8821
8821
|
|
|
8822
|
-
// src/rules/
|
|
8822
|
+
// src/rules/prefer-shorthand-properties.ts
|
|
8823
8823
|
init_cjs_shims();
|
|
8824
|
-
var
|
|
8825
|
-
var RULE_NAME10 = "no-unsafe-token-fn-usage";
|
|
8824
|
+
var RULE_NAME10 = "prefer-shorthand-properties";
|
|
8826
8825
|
var rule10 = createRule({
|
|
8827
8826
|
name: RULE_NAME10,
|
|
8827
|
+
meta: {
|
|
8828
|
+
docs: {
|
|
8829
|
+
description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
|
|
8830
|
+
},
|
|
8831
|
+
messages: {
|
|
8832
|
+
shorthand: "Use shorthand property of `{{longhand}}` instead. Prefer {{shorthand}}",
|
|
8833
|
+
replace: "Replace `{{longhand}}` with `{{shorthand}}`"
|
|
8834
|
+
},
|
|
8835
|
+
type: "suggestion",
|
|
8836
|
+
hasSuggestions: true,
|
|
8837
|
+
schema: []
|
|
8838
|
+
},
|
|
8839
|
+
defaultOptions: [],
|
|
8840
|
+
create(context) {
|
|
8841
|
+
const sendReport = (node, name2) => {
|
|
8842
|
+
const shorthands = resolveShorthands(name2, context);
|
|
8843
|
+
if (!shorthands)
|
|
8844
|
+
return;
|
|
8845
|
+
const shorthand = shorthands.map((s) => "`" + s + "`")?.join(", ");
|
|
8846
|
+
const data = {
|
|
8847
|
+
longhand: name2,
|
|
8848
|
+
shorthand
|
|
8849
|
+
};
|
|
8850
|
+
return context.report({
|
|
8851
|
+
node,
|
|
8852
|
+
messageId: "shorthand",
|
|
8853
|
+
data,
|
|
8854
|
+
suggest: [
|
|
8855
|
+
{
|
|
8856
|
+
messageId: "replace",
|
|
8857
|
+
data,
|
|
8858
|
+
fix: (fixer) => {
|
|
8859
|
+
return fixer.replaceTextRange(node.range, shorthands[0]);
|
|
8860
|
+
}
|
|
8861
|
+
}
|
|
8862
|
+
]
|
|
8863
|
+
});
|
|
8864
|
+
};
|
|
8865
|
+
return {
|
|
8866
|
+
JSXAttribute(node) {
|
|
8867
|
+
if (!isJSXIdentifier(node.name))
|
|
8868
|
+
return;
|
|
8869
|
+
if (!isPandaProp(node, context))
|
|
8870
|
+
return;
|
|
8871
|
+
const longhand = resolveLonghand(node.name.name, context);
|
|
8872
|
+
if (longhand)
|
|
8873
|
+
return;
|
|
8874
|
+
sendReport(node.name, node.name.name);
|
|
8875
|
+
},
|
|
8876
|
+
Property(node) {
|
|
8877
|
+
if (!isIdentifier(node.key))
|
|
8878
|
+
return;
|
|
8879
|
+
if (!isPandaAttribute(node, context))
|
|
8880
|
+
return;
|
|
8881
|
+
const longhand = resolveLonghand(node.key.name, context);
|
|
8882
|
+
if (longhand)
|
|
8883
|
+
return;
|
|
8884
|
+
sendReport(node.key, node.key.name);
|
|
8885
|
+
}
|
|
8886
|
+
};
|
|
8887
|
+
}
|
|
8888
|
+
});
|
|
8889
|
+
var prefer_shorthand_properties_default = rule10;
|
|
8890
|
+
|
|
8891
|
+
// src/rules/no-unsafe-token-fn-usage.ts
|
|
8892
|
+
init_cjs_shims();
|
|
8893
|
+
var import_utils15 = require("@typescript-eslint/utils");
|
|
8894
|
+
var RULE_NAME11 = "no-unsafe-token-fn-usage";
|
|
8895
|
+
var rule11 = createRule({
|
|
8896
|
+
name: RULE_NAME11,
|
|
8828
8897
|
meta: {
|
|
8829
8898
|
docs: {
|
|
8830
8899
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
@@ -8920,14 +8989,14 @@ var rule10 = createRule({
|
|
|
8920
8989
|
};
|
|
8921
8990
|
}
|
|
8922
8991
|
});
|
|
8923
|
-
var no_unsafe_token_fn_usage_default =
|
|
8992
|
+
var no_unsafe_token_fn_usage_default = rule11;
|
|
8924
8993
|
|
|
8925
8994
|
// src/rules/prefer-atomic-properties.ts
|
|
8926
8995
|
init_cjs_shims();
|
|
8927
8996
|
|
|
8928
|
-
// src/utils/
|
|
8997
|
+
// src/utils/composite-properties.ts
|
|
8929
8998
|
init_cjs_shims();
|
|
8930
|
-
var
|
|
8999
|
+
var compositeProperties = {
|
|
8931
9000
|
animation: [
|
|
8932
9001
|
"animationName",
|
|
8933
9002
|
"animationDuration",
|
|
@@ -9040,9 +9109,9 @@ var shorthandProperties = {
|
|
|
9040
9109
|
};
|
|
9041
9110
|
|
|
9042
9111
|
// src/rules/prefer-atomic-properties.ts
|
|
9043
|
-
var
|
|
9044
|
-
var
|
|
9045
|
-
name:
|
|
9112
|
+
var RULE_NAME12 = "prefer-atomic-properties";
|
|
9113
|
+
var rule12 = createRule({
|
|
9114
|
+
name: RULE_NAME12,
|
|
9046
9115
|
meta: {
|
|
9047
9116
|
docs: {
|
|
9048
9117
|
description: "Encourage the use of atomic properties instead of composite shorthand properties in the codebase."
|
|
@@ -9056,15 +9125,15 @@ var rule11 = createRule({
|
|
|
9056
9125
|
defaultOptions: [],
|
|
9057
9126
|
create(context) {
|
|
9058
9127
|
const resolveCompositeProperty = (name2) => {
|
|
9059
|
-
if (Object.hasOwn(
|
|
9128
|
+
if (Object.hasOwn(compositeProperties, name2))
|
|
9060
9129
|
return name2;
|
|
9061
|
-
const longhand =
|
|
9062
|
-
if (isValidProperty(longhand, context) && Object.hasOwn(
|
|
9130
|
+
const longhand = resolveLonghand(name2, context) ?? name2;
|
|
9131
|
+
if (isValidProperty(longhand, context) && Object.hasOwn(compositeProperties, longhand))
|
|
9063
9132
|
return longhand;
|
|
9064
9133
|
};
|
|
9065
9134
|
const sendReport = (node, name2) => {
|
|
9066
9135
|
const cpd = resolveCompositeProperty(name2);
|
|
9067
|
-
const atomics =
|
|
9136
|
+
const atomics = compositeProperties[cpd].map((name3) => `\`${name3}\``).join(",\n");
|
|
9068
9137
|
return context.report({
|
|
9069
9138
|
node,
|
|
9070
9139
|
messageId: "atomic",
|
|
@@ -9098,7 +9167,7 @@ var rule11 = createRule({
|
|
|
9098
9167
|
};
|
|
9099
9168
|
}
|
|
9100
9169
|
});
|
|
9101
|
-
var prefer_atomic_properties_default =
|
|
9170
|
+
var prefer_atomic_properties_default = rule12;
|
|
9102
9171
|
|
|
9103
9172
|
// src/rules/index.ts
|
|
9104
9173
|
var rules = {
|
|
@@ -9110,9 +9179,10 @@ var rules = {
|
|
|
9110
9179
|
[RULE_NAME6]: no_hardcoded_color_default,
|
|
9111
9180
|
[RULE_NAME7]: no_invalid_token_paths_default,
|
|
9112
9181
|
[RULE_NAME8]: no_property_renaming_default,
|
|
9113
|
-
[RULE_NAME9]:
|
|
9114
|
-
[RULE_NAME10]:
|
|
9115
|
-
[RULE_NAME11]:
|
|
9182
|
+
[RULE_NAME9]: prefer_longhand_properties_default,
|
|
9183
|
+
[RULE_NAME10]: prefer_shorthand_properties_default,
|
|
9184
|
+
[RULE_NAME11]: no_unsafe_token_fn_usage_default,
|
|
9185
|
+
[RULE_NAME12]: prefer_atomic_properties_default
|
|
9116
9186
|
};
|
|
9117
9187
|
|
|
9118
9188
|
// src/configs/all.ts
|
package/dist/index.mjs
CHANGED
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
__esm,
|
|
4
4
|
__toESM,
|
|
5
5
|
init_esm_shims
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HALLAYDZ.mjs";
|
|
7
7
|
|
|
8
8
|
// package.json
|
|
9
9
|
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.10";
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -7974,7 +7974,7 @@ var init_nodes = __esm({
|
|
|
7974
7974
|
});
|
|
7975
7975
|
|
|
7976
7976
|
// src/utils/helpers.ts
|
|
7977
|
-
var import_scope_manager, getAncestor, getSyncOpts, getImportSpecifiers, _getImports, getImports, isValidStyledProp, isPandaIsh, findDeclaration, isLocalStyledFactory, isValidFile, isValidProperty, isPandaImport, isPandaProp, isInPandaFunction, isPandaAttribute, resolveLonghand,
|
|
7977
|
+
var import_scope_manager, getAncestor, getSyncOpts, getImportSpecifiers, _getImports, getImports, isValidStyledProp, isPandaIsh, findDeclaration, isLocalStyledFactory, isValidFile, isValidProperty, isPandaImport, isPandaProp, isInPandaFunction, isPandaAttribute, resolveLonghand, resolveShorthands, isColorAttribute, isColorToken, extractTokens, getInvalidTokens, getTokenImport;
|
|
7978
7978
|
var init_helpers = __esm({
|
|
7979
7979
|
"src/utils/helpers.ts"() {
|
|
7980
7980
|
"use strict";
|
|
@@ -8137,8 +8137,8 @@ var init_helpers = __esm({
|
|
|
8137
8137
|
resolveLonghand = (name2, context) => {
|
|
8138
8138
|
return syncAction("resolveLongHand", getSyncOpts(context), name2);
|
|
8139
8139
|
};
|
|
8140
|
-
|
|
8141
|
-
return syncAction("
|
|
8140
|
+
resolveShorthands = (name2, context) => {
|
|
8141
|
+
return syncAction("resolveShorthands", getSyncOpts(context), name2);
|
|
8142
8142
|
};
|
|
8143
8143
|
isColorAttribute = (attr, context) => {
|
|
8144
8144
|
return syncAction("isColorAttribute", getSyncOpts(context), attr);
|
|
@@ -8168,7 +8168,7 @@ var init_helpers = __esm({
|
|
|
8168
8168
|
const tokens = extractTokens(value);
|
|
8169
8169
|
if (!tokens.length)
|
|
8170
8170
|
return [];
|
|
8171
|
-
return syncAction("
|
|
8171
|
+
return syncAction("filterInvalidTokens", getSyncOpts(context), tokens);
|
|
8172
8172
|
};
|
|
8173
8173
|
getTokenImport = (context) => {
|
|
8174
8174
|
const imports = _getImports(context);
|
|
@@ -8803,21 +8803,21 @@ var init_no_property_renaming = __esm({
|
|
|
8803
8803
|
}
|
|
8804
8804
|
});
|
|
8805
8805
|
|
|
8806
|
-
// src/rules/
|
|
8807
|
-
var RULE_NAME9, rule9,
|
|
8808
|
-
var
|
|
8809
|
-
"src/rules/
|
|
8806
|
+
// src/rules/prefer-longhand-properties.ts
|
|
8807
|
+
var RULE_NAME9, rule9, prefer_longhand_properties_default;
|
|
8808
|
+
var init_prefer_longhand_properties = __esm({
|
|
8809
|
+
"src/rules/prefer-longhand-properties.ts"() {
|
|
8810
8810
|
"use strict";
|
|
8811
8811
|
init_esm_shims();
|
|
8812
8812
|
init_helpers();
|
|
8813
8813
|
init_utils();
|
|
8814
8814
|
init_nodes();
|
|
8815
|
-
RULE_NAME9 = "
|
|
8815
|
+
RULE_NAME9 = "prefer-longhand-properties";
|
|
8816
8816
|
rule9 = createRule({
|
|
8817
8817
|
name: RULE_NAME9,
|
|
8818
8818
|
meta: {
|
|
8819
8819
|
docs: {
|
|
8820
|
-
description: "Discourage the use of shorthand properties and promote the preference for longhand
|
|
8820
|
+
description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
|
|
8821
8821
|
},
|
|
8822
8822
|
messages: {
|
|
8823
8823
|
longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`",
|
|
@@ -8874,13 +8874,91 @@ var init_no_shorthand_prop = __esm({
|
|
|
8874
8874
|
};
|
|
8875
8875
|
}
|
|
8876
8876
|
});
|
|
8877
|
-
|
|
8877
|
+
prefer_longhand_properties_default = rule9;
|
|
8878
|
+
}
|
|
8879
|
+
});
|
|
8880
|
+
|
|
8881
|
+
// src/rules/prefer-shorthand-properties.ts
|
|
8882
|
+
var RULE_NAME10, rule10, prefer_shorthand_properties_default;
|
|
8883
|
+
var init_prefer_shorthand_properties = __esm({
|
|
8884
|
+
"src/rules/prefer-shorthand-properties.ts"() {
|
|
8885
|
+
"use strict";
|
|
8886
|
+
init_esm_shims();
|
|
8887
|
+
init_helpers();
|
|
8888
|
+
init_utils();
|
|
8889
|
+
init_nodes();
|
|
8890
|
+
RULE_NAME10 = "prefer-shorthand-properties";
|
|
8891
|
+
rule10 = createRule({
|
|
8892
|
+
name: RULE_NAME10,
|
|
8893
|
+
meta: {
|
|
8894
|
+
docs: {
|
|
8895
|
+
description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
|
|
8896
|
+
},
|
|
8897
|
+
messages: {
|
|
8898
|
+
shorthand: "Use shorthand property of `{{longhand}}` instead. Prefer {{shorthand}}",
|
|
8899
|
+
replace: "Replace `{{longhand}}` with `{{shorthand}}`"
|
|
8900
|
+
},
|
|
8901
|
+
type: "suggestion",
|
|
8902
|
+
hasSuggestions: true,
|
|
8903
|
+
schema: []
|
|
8904
|
+
},
|
|
8905
|
+
defaultOptions: [],
|
|
8906
|
+
create(context) {
|
|
8907
|
+
const sendReport = (node, name2) => {
|
|
8908
|
+
const shorthands = resolveShorthands(name2, context);
|
|
8909
|
+
if (!shorthands)
|
|
8910
|
+
return;
|
|
8911
|
+
const shorthand = shorthands.map((s) => "`" + s + "`")?.join(", ");
|
|
8912
|
+
const data = {
|
|
8913
|
+
longhand: name2,
|
|
8914
|
+
shorthand
|
|
8915
|
+
};
|
|
8916
|
+
return context.report({
|
|
8917
|
+
node,
|
|
8918
|
+
messageId: "shorthand",
|
|
8919
|
+
data,
|
|
8920
|
+
suggest: [
|
|
8921
|
+
{
|
|
8922
|
+
messageId: "replace",
|
|
8923
|
+
data,
|
|
8924
|
+
fix: (fixer) => {
|
|
8925
|
+
return fixer.replaceTextRange(node.range, shorthands[0]);
|
|
8926
|
+
}
|
|
8927
|
+
}
|
|
8928
|
+
]
|
|
8929
|
+
});
|
|
8930
|
+
};
|
|
8931
|
+
return {
|
|
8932
|
+
JSXAttribute(node) {
|
|
8933
|
+
if (!isJSXIdentifier(node.name))
|
|
8934
|
+
return;
|
|
8935
|
+
if (!isPandaProp(node, context))
|
|
8936
|
+
return;
|
|
8937
|
+
const longhand = resolveLonghand(node.name.name, context);
|
|
8938
|
+
if (longhand)
|
|
8939
|
+
return;
|
|
8940
|
+
sendReport(node.name, node.name.name);
|
|
8941
|
+
},
|
|
8942
|
+
Property(node) {
|
|
8943
|
+
if (!isIdentifier(node.key))
|
|
8944
|
+
return;
|
|
8945
|
+
if (!isPandaAttribute(node, context))
|
|
8946
|
+
return;
|
|
8947
|
+
const longhand = resolveLonghand(node.key.name, context);
|
|
8948
|
+
if (longhand)
|
|
8949
|
+
return;
|
|
8950
|
+
sendReport(node.key, node.key.name);
|
|
8951
|
+
}
|
|
8952
|
+
};
|
|
8953
|
+
}
|
|
8954
|
+
});
|
|
8955
|
+
prefer_shorthand_properties_default = rule10;
|
|
8878
8956
|
}
|
|
8879
8957
|
});
|
|
8880
8958
|
|
|
8881
8959
|
// src/rules/no-unsafe-token-fn-usage.ts
|
|
8882
8960
|
import "@typescript-eslint/utils";
|
|
8883
|
-
var
|
|
8961
|
+
var RULE_NAME11, rule11, no_unsafe_token_fn_usage_default;
|
|
8884
8962
|
var init_no_unsafe_token_fn_usage = __esm({
|
|
8885
8963
|
"src/rules/no-unsafe-token-fn-usage.ts"() {
|
|
8886
8964
|
"use strict";
|
|
@@ -8888,9 +8966,9 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
8888
8966
|
init_helpers();
|
|
8889
8967
|
init_utils();
|
|
8890
8968
|
init_nodes();
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
name:
|
|
8969
|
+
RULE_NAME11 = "no-unsafe-token-fn-usage";
|
|
8970
|
+
rule11 = createRule({
|
|
8971
|
+
name: RULE_NAME11,
|
|
8894
8972
|
meta: {
|
|
8895
8973
|
docs: {
|
|
8896
8974
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
@@ -8986,17 +9064,17 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
8986
9064
|
};
|
|
8987
9065
|
}
|
|
8988
9066
|
});
|
|
8989
|
-
no_unsafe_token_fn_usage_default =
|
|
9067
|
+
no_unsafe_token_fn_usage_default = rule11;
|
|
8990
9068
|
}
|
|
8991
9069
|
});
|
|
8992
9070
|
|
|
8993
|
-
// src/utils/
|
|
8994
|
-
var
|
|
8995
|
-
var
|
|
8996
|
-
"src/utils/
|
|
9071
|
+
// src/utils/composite-properties.ts
|
|
9072
|
+
var compositeProperties;
|
|
9073
|
+
var init_composite_properties = __esm({
|
|
9074
|
+
"src/utils/composite-properties.ts"() {
|
|
8997
9075
|
"use strict";
|
|
8998
9076
|
init_esm_shims();
|
|
8999
|
-
|
|
9077
|
+
compositeProperties = {
|
|
9000
9078
|
animation: [
|
|
9001
9079
|
"animationName",
|
|
9002
9080
|
"animationDuration",
|
|
@@ -9111,18 +9189,18 @@ var init_shorthand_properties = __esm({
|
|
|
9111
9189
|
});
|
|
9112
9190
|
|
|
9113
9191
|
// src/rules/prefer-atomic-properties.ts
|
|
9114
|
-
var
|
|
9192
|
+
var RULE_NAME12, rule12, prefer_atomic_properties_default;
|
|
9115
9193
|
var init_prefer_atomic_properties = __esm({
|
|
9116
9194
|
"src/rules/prefer-atomic-properties.ts"() {
|
|
9117
9195
|
"use strict";
|
|
9118
9196
|
init_esm_shims();
|
|
9119
9197
|
init_helpers();
|
|
9120
9198
|
init_utils();
|
|
9121
|
-
|
|
9199
|
+
init_composite_properties();
|
|
9122
9200
|
init_nodes();
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
name:
|
|
9201
|
+
RULE_NAME12 = "prefer-atomic-properties";
|
|
9202
|
+
rule12 = createRule({
|
|
9203
|
+
name: RULE_NAME12,
|
|
9126
9204
|
meta: {
|
|
9127
9205
|
docs: {
|
|
9128
9206
|
description: "Encourage the use of atomic properties instead of composite shorthand properties in the codebase."
|
|
@@ -9136,15 +9214,15 @@ var init_prefer_atomic_properties = __esm({
|
|
|
9136
9214
|
defaultOptions: [],
|
|
9137
9215
|
create(context) {
|
|
9138
9216
|
const resolveCompositeProperty = (name2) => {
|
|
9139
|
-
if (Object.hasOwn(
|
|
9217
|
+
if (Object.hasOwn(compositeProperties, name2))
|
|
9140
9218
|
return name2;
|
|
9141
|
-
const longhand =
|
|
9142
|
-
if (isValidProperty(longhand, context) && Object.hasOwn(
|
|
9219
|
+
const longhand = resolveLonghand(name2, context) ?? name2;
|
|
9220
|
+
if (isValidProperty(longhand, context) && Object.hasOwn(compositeProperties, longhand))
|
|
9143
9221
|
return longhand;
|
|
9144
9222
|
};
|
|
9145
9223
|
const sendReport = (node, name2) => {
|
|
9146
9224
|
const cpd = resolveCompositeProperty(name2);
|
|
9147
|
-
const atomics =
|
|
9225
|
+
const atomics = compositeProperties[cpd].map((name3) => `\`${name3}\``).join(",\n");
|
|
9148
9226
|
return context.report({
|
|
9149
9227
|
node,
|
|
9150
9228
|
messageId: "atomic",
|
|
@@ -9178,7 +9256,7 @@ var init_prefer_atomic_properties = __esm({
|
|
|
9178
9256
|
};
|
|
9179
9257
|
}
|
|
9180
9258
|
});
|
|
9181
|
-
prefer_atomic_properties_default =
|
|
9259
|
+
prefer_atomic_properties_default = rule12;
|
|
9182
9260
|
}
|
|
9183
9261
|
});
|
|
9184
9262
|
|
|
@@ -9196,7 +9274,8 @@ var init_rules = __esm({
|
|
|
9196
9274
|
init_no_hardcoded_color();
|
|
9197
9275
|
init_no_invalid_token_paths();
|
|
9198
9276
|
init_no_property_renaming();
|
|
9199
|
-
|
|
9277
|
+
init_prefer_longhand_properties();
|
|
9278
|
+
init_prefer_shorthand_properties();
|
|
9200
9279
|
init_no_unsafe_token_fn_usage();
|
|
9201
9280
|
init_prefer_atomic_properties();
|
|
9202
9281
|
rules = {
|
|
@@ -9208,9 +9287,10 @@ var init_rules = __esm({
|
|
|
9208
9287
|
[RULE_NAME6]: no_hardcoded_color_default,
|
|
9209
9288
|
[RULE_NAME7]: no_invalid_token_paths_default,
|
|
9210
9289
|
[RULE_NAME8]: no_property_renaming_default,
|
|
9211
|
-
[RULE_NAME9]:
|
|
9212
|
-
[RULE_NAME10]:
|
|
9213
|
-
[RULE_NAME11]:
|
|
9290
|
+
[RULE_NAME9]: prefer_longhand_properties_default,
|
|
9291
|
+
[RULE_NAME10]: prefer_shorthand_properties_default,
|
|
9292
|
+
[RULE_NAME11]: no_unsafe_token_fn_usage_default,
|
|
9293
|
+
[RULE_NAME12]: prefer_atomic_properties_default
|
|
9214
9294
|
};
|
|
9215
9295
|
}
|
|
9216
9296
|
});
|