@salesforce-ux/eslint-plugin-slds 1.0.8-internal → 1.0.9-internal
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/build/config/rule-messages.d.ts +2 -0
- package/build/config/rule-messages.js +197 -0
- package/build/config/rule-messages.js.map +7 -0
- package/build/index.js +40 -2471
- package/build/index.js.map +4 -4
- package/build/rules/enforce-bem-usage.js +16 -232
- package/build/rules/enforce-bem-usage.js.map +4 -4
- package/build/rules/modal-close-button-issue.js +11 -183
- package/build/rules/modal-close-button-issue.js.map +4 -4
- package/build/rules/no-deprecated-classes-slds2.js +4 -176
- package/build/rules/no-deprecated-classes-slds2.js.map +4 -4
- package/build/rules/v9/enforce-bem-usage.js +1 -161
- package/build/rules/v9/enforce-bem-usage.js.map +4 -4
- package/build/rules/v9/enforce-component-hook-naming-convention.js +1 -161
- package/build/rules/v9/enforce-component-hook-naming-convention.js.map +4 -4
- package/build/rules/v9/enforce-sds-to-slds-hooks.js +1 -161
- package/build/rules/v9/enforce-sds-to-slds-hooks.js.map +4 -4
- package/build/rules/v9/lwc-token-to-slds-hook.js +4 -262
- package/build/rules/v9/lwc-token-to-slds-hook.js.map +4 -4
- package/build/rules/v9/no-deprecated-slds-classes.js +1 -161
- package/build/rules/v9/no-deprecated-slds-classes.js.map +4 -4
- package/build/rules/v9/no-deprecated-tokens-slds1.js +29 -168
- package/build/rules/v9/no-deprecated-tokens-slds1.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/handlers/boxShadowHandler.js +9 -289
- package/build/rules/v9/no-hardcoded-values/handlers/boxShadowHandler.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/handlers/colorHandler.js +13 -283
- package/build/rules/v9/no-hardcoded-values/handlers/colorHandler.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/handlers/densityHandler.js +12 -328
- package/build/rules/v9/no-hardcoded-values/handlers/densityHandler.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/handlers/fontHandler.js +13 -309
- package/build/rules/v9/no-hardcoded-values/handlers/fontHandler.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/handlers/index.js +8 -875
- package/build/rules/v9/no-hardcoded-values/handlers/index.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/no-hardcoded-values-slds1.js +3 -1208
- package/build/rules/v9/no-hardcoded-values/no-hardcoded-values-slds1.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/no-hardcoded-values-slds2.js +3 -1208
- package/build/rules/v9/no-hardcoded-values/no-hardcoded-values-slds2.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/noHardcodedValueRule.js +22 -993
- package/build/rules/v9/no-hardcoded-values/noHardcodedValueRule.js.map +4 -4
- package/build/rules/v9/no-slds-class-overrides.js +1 -161
- package/build/rules/v9/no-slds-class-overrides.js.map +4 -4
- package/build/rules/v9/no-slds-namespace-for-custom-hooks.js +3 -252
- package/build/rules/v9/no-slds-namespace-for-custom-hooks.js.map +4 -4
- package/build/rules/v9/no-slds-private-var.js +1 -161
- package/build/rules/v9/no-slds-private-var.js.map +4 -4
- package/build/rules/v9/no-slds-var-without-fallback.js +3 -255
- package/build/rules/v9/no-slds-var-without-fallback.js.map +4 -4
- package/build/rules/v9/no-sldshook-fallback-for-lwctoken.js +1 -161
- package/build/rules/v9/no-sldshook-fallback-for-lwctoken.js.map +4 -4
- package/build/rules/v9/no-unsupported-hooks-slds2.js +1 -161
- package/build/rules/v9/no-unsupported-hooks-slds2.js.map +4 -4
- package/build/rules/v9/reduce-annotations.js +1 -161
- package/build/rules/v9/reduce-annotations.js.map +4 -4
- package/build/{src/utils → utils}/boxShadowValueParser.d.ts +1 -1
- package/build/utils/boxShadowValueParser.js +63 -93
- package/build/utils/boxShadowValueParser.js.map +4 -4
- package/build/utils/color-lib-utils.js +2 -29
- package/build/utils/color-lib-utils.js.map +3 -3
- package/build/{src/utils → utils}/css-utils.d.ts +7 -0
- package/build/utils/css-utils.js +10 -71
- package/build/utils/css-utils.js.map +4 -4
- package/build/utils/hardcoded-shared-utils.js +17 -82
- package/build/utils/hardcoded-shared-utils.js.map +4 -4
- package/build/utils/property-matcher.js +2 -2
- package/build/utils/property-matcher.js.map +2 -2
- package/build/utils/styling-hook-utils.js +16 -39
- package/build/utils/styling-hook-utils.js.map +3 -3
- package/build/{src/utils → utils}/value-utils.d.ts +2 -2
- package/build/utils/value-utils.js +8 -8
- package/build/utils/value-utils.js.map +2 -2
- package/package.json +5 -10
- package/src/config/rule-messages.yml +0 -143
- /package/build/{src/index.d.ts → index.d.ts} +0 -0
- /package/build/{src/rules → rules}/enforce-bem-usage.d.ts +0 -0
- /package/build/{src/rules → rules}/modal-close-button-issue.d.ts +0 -0
- /package/build/{src/rules → rules}/no-deprecated-classes-slds2.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/enforce-bem-usage.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/enforce-component-hook-naming-convention.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/enforce-sds-to-slds-hooks.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/lwc-token-to-slds-hook.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-deprecated-slds-classes.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-deprecated-tokens-slds1.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/handlers/boxShadowHandler.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/handlers/colorHandler.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/handlers/densityHandler.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/handlers/fontHandler.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/handlers/index.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/no-hardcoded-values-slds1.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/no-hardcoded-values-slds2.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/noHardcodedValueRule.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/ruleOptionsSchema.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-slds-class-overrides.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-slds-namespace-for-custom-hooks.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-slds-private-var.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-slds-var-without-fallback.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-sldshook-fallback-for-lwctoken.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-unsupported-hooks-slds2.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/reduce-annotations.d.ts +0 -0
- /package/build/{src/types → types}/index.d.ts +0 -0
- /package/build/{src/utils → utils}/color-lib-utils.d.ts +0 -0
- /package/build/{src/utils → utils}/css-functions.d.ts +0 -0
- /package/build/{src/utils → utils}/custom-mapping-utils.d.ts +0 -0
- /package/build/{src/utils → utils}/hardcoded-shared-utils.d.ts +0 -0
- /package/build/{src/utils → utils}/node.d.ts +0 -0
- /package/build/{src/utils → utils}/property-matcher.d.ts +0 -0
- /package/build/{src/utils → utils}/rule-utils.d.ts +0 -0
- /package/build/{src/utils → utils}/styling-hook-utils.d.ts +0 -0
|
@@ -4,9 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
7
|
var __export = (target, all) => {
|
|
11
8
|
for (var name in all)
|
|
12
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -29,163 +26,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
26
|
));
|
|
30
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
28
|
|
|
32
|
-
// yaml-file:rule-messages.yml
|
|
33
|
-
var require_rule_messages = __commonJS({
|
|
34
|
-
"yaml-file:rule-messages.yml"(exports2, module2) {
|
|
35
|
-
module2.exports = {
|
|
36
|
-
"no-slds-class-overrides": {
|
|
37
|
-
"description": "Create new custom CSS classes instead of overriding SLDS selectors",
|
|
38
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-class-overrides",
|
|
39
|
-
"type": "problem",
|
|
40
|
-
"messages": {
|
|
41
|
-
"sldsClassOverride": "Overriding .{{className}} isn't supported. To differentiate SLDS and custom classes, create a CSS class in your namespace. Examples: myapp-input, myapp-button."
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"no-deprecated-slds-classes": {
|
|
45
|
-
"description": "Please replace the deprecated classes with a modern equivalent",
|
|
46
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-slds-classes",
|
|
47
|
-
"type": "problem",
|
|
48
|
-
"messages": {
|
|
49
|
-
"deprecatedClass": "The class {{className}} is deprecated and not available in SLDS2. Please update to a supported class."
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"no-deprecated-tokens-slds1": {
|
|
53
|
-
"description": "Update outdated design tokens to SLDS 2 styling hooks with similar values. For more information, see Styling Hooks on lightningdesignsystem.com.",
|
|
54
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-tokens-slds1",
|
|
55
|
-
"type": "problem",
|
|
56
|
-
"messages": {
|
|
57
|
-
"deprecatedToken": "Consider removing {{oldValue}} or replacing it with {{newValue}}. Set the fallback to {{oldValue}}. For more info, see Styling Hooks on lightningdesignsystem.com.",
|
|
58
|
-
"noReplacement": "Update outdated design tokens to SLDS 2 styling hooks with similar values. For more information, see Styling Hooks on lightningdesignsystem.com."
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"enforce-sds-to-slds-hooks": {
|
|
62
|
-
"description": "Convert your existing --sds styling hooks to --slds styling hooks. See lightningdesignsystem.com for more info.",
|
|
63
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-sds-to-slds-hooks",
|
|
64
|
-
"type": "problem",
|
|
65
|
-
"messages": {
|
|
66
|
-
"replaceSdsWithSlds": "Replace {{oldValue}} with {{suggestedMatch}} styling hook."
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"enforce-bem-usage": {
|
|
70
|
-
"description": "Replace BEM double-dash syntax in class names with single underscore syntax",
|
|
71
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-bem-usage",
|
|
72
|
-
"type": "problem",
|
|
73
|
-
"messages": {
|
|
74
|
-
"bemDoubleDash": "{{actual}} has been retired. Update it to the new name {{newValue}}.",
|
|
75
|
-
"fixBemNaming": "Update to correct BEM naming convention"
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
"modal-close-button-issue": {
|
|
79
|
-
"description": "Update component attributes or CSS classes for the modal close button to comply with the modal component blueprint",
|
|
80
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#modal-close-button-issue",
|
|
81
|
-
"type": "problem",
|
|
82
|
-
"messages": {
|
|
83
|
-
"modalCloseButtonIssue": "Update component attributes or CSS classes for the modal close button to comply with the modal component blueprint.",
|
|
84
|
-
"removeClass": "Remove the slds-button_icon-inverse class from the modal close button in components that use the SLDS modal blueprint.",
|
|
85
|
-
"changeVariant": "Change the variant attribute value from bare-inverse to bare in <lightning-button-icon> or <lightning-icon>.",
|
|
86
|
-
"removeVariant": "Remove the variant attribute from the <lightning-icon> component inside the <button> element.",
|
|
87
|
-
"ensureButtonClasses": "Add or move slds-button and slds-button_icon to the class attribute of the <button> element or <lightning-button-icon> component.",
|
|
88
|
-
"ensureSizeAttribute": "To size icons properly, set the size attribute \u200Cto large in the <lightning-icon> and <lightning-button-icon> components."
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"no-deprecated-classes-slds2": {
|
|
92
|
-
"description": "Replace classes that aren't available with SLDS 2 classes",
|
|
93
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-classes-slds2",
|
|
94
|
-
"type": "problem",
|
|
95
|
-
"messages": {
|
|
96
|
-
"deprecatedClass": "The class {{className}} isn't available in SLDS 2. Update it to a class supported in SLDS 2. See lightningdesignsystem.com for more information.",
|
|
97
|
-
"updateToModernClass": "Replace deprecated class with modern equivalent",
|
|
98
|
-
"checkDocumentation": "See lightningdesignsystem.com for SLDS 2 class alternatives"
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
"lwc-token-to-slds-hook": {
|
|
102
|
-
"description": "Replace the deprecated --lwc tokens with the latest --slds tokens. See lightningdesignsystem.com for more info.",
|
|
103
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#lwc-token-to-slds-hook",
|
|
104
|
-
"type": "problem",
|
|
105
|
-
"messages": {
|
|
106
|
-
"errorWithReplacement": "The '{{oldValue}}' design token is deprecated. Replace it with '{{newValue}}'. For more info, see Global Styling Hooks on lightningdesignsystem.com.",
|
|
107
|
-
"errorWithStyleHooks": "The '{{oldValue}}' design token is deprecated. Replace it with the SLDS 2 '{{newValue}}' styling hook and set the fallback to '{{oldValue}}'. For more info, see Global Styling Hooks on lightningdesignsystem.com.",
|
|
108
|
-
"errorWithNoRecommendation": "The '{{oldValue}}' design token is deprecated. For more info, see the New Global Styling Hook Guidance on lightningdesignsystem.com."
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
"no-sldshook-fallback-for-lwctoken": {
|
|
112
|
-
"description": "Avoid using --slds styling hooks as fallback values for --lwc tokens.",
|
|
113
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-sldshook-fallback-for-lwctoken",
|
|
114
|
-
"type": "problem",
|
|
115
|
-
"messages": {
|
|
116
|
-
"unsupportedFallback": "Remove the {{sldsToken}} styling hook that is used as a fallback value for {{lwcToken}}."
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
"no-unsupported-hooks-slds2": {
|
|
120
|
-
"description": "Identifies styling hooks that aren't present in SLDS 2. They must be replaced with styling hooks that have a similar effect, or they must be removed.",
|
|
121
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-unsupported-hooks-slds2",
|
|
122
|
-
"type": "problem",
|
|
123
|
-
"messages": {
|
|
124
|
-
"deprecated": "The {{token}} styling hook isn't present in SLDS 2 and there's no equivalent replacement. Remove it or replace it with a styling hook with a similar effect."
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
"no-slds-var-without-fallback": {
|
|
128
|
-
"description": "Add fallback values to SLDS styling hooks. The fallback values are used in Salesforce environments where styling hooks are unavailable.",
|
|
129
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-var-without-fallback",
|
|
130
|
-
"type": "problem",
|
|
131
|
-
"messages": {
|
|
132
|
-
"varWithoutFallback": "Your code uses the {{cssVar}} styling hook without a fallback value. Styling hooks are unavailable in some Salesforce environments. To render your component correctly in all environments, add this fallback value: var({{cssVar}}, {{recommendation}}). To make this fallback value brand-aware, use a branded design token instead of a static value. See Design Tokens on v1.lightningdesignsystem.com."
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
"no-slds-namespace-for-custom-hooks": {
|
|
136
|
-
"description": "To differentiate custom styling hooks from SLDS styling hooks, create custom styling hooks in your namespace.",
|
|
137
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-namespace-for-custom-hooks",
|
|
138
|
-
"type": "problem",
|
|
139
|
-
"messages": {
|
|
140
|
-
"customHookNamespace": "Using the --slds namespace for {{token}} isn't supported. Create the custom styling hook in your namespace. Example: --myapp-{{tokenWithoutNamespace}}"
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
"no-slds-private-var": {
|
|
144
|
-
"description": "Some SLDS styling hooks are private and reserved only for internal Salesforce use. Private SLDS styling hooks have prefixes --_slds- and --slds-s-. For more information, look up private CSS in lightningdesignsystem.com.",
|
|
145
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-private-var",
|
|
146
|
-
"type": "problem",
|
|
147
|
-
"messages": {
|
|
148
|
-
"privateVar": "This styling hook is reserved for internal Salesforce use. Remove the --_slds- or \u2013slds-s private variable within selector {{prop}}. For more information, look up private CSS in lightningdesignsystem.com."
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
"enforce-component-hook-naming-convention": {
|
|
152
|
-
"description": "Replace component styling hooks that use a deprecated naming convention.",
|
|
153
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-component-hook-naming-convention",
|
|
154
|
-
"type": "problem",
|
|
155
|
-
"messages": {
|
|
156
|
-
"replace": "Replace the deprecated {{oldValue}} component styling hook with {{suggestedMatch}}."
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
"no-hardcoded-values-slds1": {
|
|
160
|
-
"description": "Replace static values with SLDS 1 design tokens. For more information, look up design tokens on lightningdesignsystem.com.",
|
|
161
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-hardcoded-value",
|
|
162
|
-
"type": "suggestion",
|
|
163
|
-
"messages": {
|
|
164
|
-
"hardcodedValue": "Replace the {{oldValue}} static value with an SLDS 1 styling hook: {{newValue}}.",
|
|
165
|
-
"noReplacement": "There's no replacement styling hook for the {{oldValue}} static value. Remove the static value."
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
"no-hardcoded-values-slds2": {
|
|
169
|
-
"description": "Replace static values with SLDS 2 styling hooks. For more information, look up design tokens on lightningdesignsystem.com.",
|
|
170
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-hardcoded-values-slds2",
|
|
171
|
-
"type": "suggestion",
|
|
172
|
-
"messages": {
|
|
173
|
-
"hardcodedValue": "Consider replacing the {{oldValue}} static value with an SLDS 2 styling hook that has a similar value: {{newValue}}.",
|
|
174
|
-
"noReplacement": "There's no replacement styling hook for the {{oldValue}} static value. Remove the static value."
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
"reduce-annotations": {
|
|
178
|
-
"description": "Remove your annotations and update your code.",
|
|
179
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#reduce-annotations",
|
|
180
|
-
"type": "problem",
|
|
181
|
-
"messages": {
|
|
182
|
-
"removeAnnotation": "Remove this annotation and update the code to SLDS best practices. For help, file an issue at https://github.com/salesforce-ux/slds-linter/"
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
|
|
189
29
|
// src/rules/v9/no-deprecated-slds-classes.ts
|
|
190
30
|
var no_deprecated_slds_classes_exports = {};
|
|
191
31
|
__export(no_deprecated_slds_classes_exports, {
|
|
@@ -193,7 +33,7 @@ __export(no_deprecated_slds_classes_exports, {
|
|
|
193
33
|
});
|
|
194
34
|
module.exports = __toCommonJS(no_deprecated_slds_classes_exports);
|
|
195
35
|
var import_next = __toESM(require("@salesforce-ux/sds-metadata/next"));
|
|
196
|
-
var import_rule_messages = __toESM(
|
|
36
|
+
var import_rule_messages = __toESM(require("../../config/rule-messages"));
|
|
197
37
|
var { type, description, url, messages } = import_rule_messages.default["no-deprecated-slds-classes"];
|
|
198
38
|
var deprecatedClasses = import_next.default.deprecatedClasses;
|
|
199
39
|
var deprecatedClassesSet = new Set(deprecatedClasses);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
4
|
-
"sourcesContent": ["module.exports = {\n \"no-slds-class-overrides\": {\n \"description\": \"Create new custom CSS classes instead of overriding SLDS selectors\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-class-overrides\",\n \"type\": \"problem\",\n \"messages\": {\n \"sldsClassOverride\": \"Overriding .{{className}} isn't supported. To differentiate SLDS and custom classes, create a CSS class in your namespace. Examples: myapp-input, myapp-button.\"\n }\n },\n \"no-deprecated-slds-classes\": {\n \"description\": \"Please replace the deprecated classes with a modern equivalent\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-slds-classes\",\n \"type\": \"problem\",\n \"messages\": {\n \"deprecatedClass\": \"The class {{className}} is deprecated and not available in SLDS2. Please update to a supported class.\"\n }\n },\n \"no-deprecated-tokens-slds1\": {\n \"description\": \"Update outdated design tokens to SLDS 2 styling hooks with similar values. For more information, see Styling Hooks on lightningdesignsystem.com.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-tokens-slds1\",\n \"type\": \"problem\",\n \"messages\": {\n \"deprecatedToken\": \"Consider removing {{oldValue}} or replacing it with {{newValue}}. Set the fallback to {{oldValue}}. For more info, see Styling Hooks on lightningdesignsystem.com.\",\n \"noReplacement\": \"Update outdated design tokens to SLDS 2 styling hooks with similar values. For more information, see Styling Hooks on lightningdesignsystem.com.\"\n }\n },\n \"enforce-sds-to-slds-hooks\": {\n \"description\": \"Convert your existing --sds styling hooks to --slds styling hooks. See lightningdesignsystem.com for more info.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-sds-to-slds-hooks\",\n \"type\": \"problem\",\n \"messages\": {\n \"replaceSdsWithSlds\": \"Replace {{oldValue}} with {{suggestedMatch}} styling hook.\"\n }\n },\n \"enforce-bem-usage\": {\n \"description\": \"Replace BEM double-dash syntax in class names with single underscore syntax\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-bem-usage\",\n \"type\": \"problem\",\n \"messages\": {\n \"bemDoubleDash\": \"{{actual}} has been retired. Update it to the new name {{newValue}}.\",\n \"fixBemNaming\": \"Update to correct BEM naming convention\"\n }\n },\n \"modal-close-button-issue\": {\n \"description\": \"Update component attributes or CSS classes for the modal close button to comply with the modal component blueprint\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#modal-close-button-issue\",\n \"type\": \"problem\",\n \"messages\": {\n \"modalCloseButtonIssue\": \"Update component attributes or CSS classes for the modal close button to comply with the modal component blueprint.\",\n \"removeClass\": \"Remove the slds-button_icon-inverse class from the modal close button in components that use the SLDS modal blueprint.\",\n \"changeVariant\": \"Change the variant attribute value from bare-inverse to bare in <lightning-button-icon> or <lightning-icon>.\",\n \"removeVariant\": \"Remove the variant attribute from the <lightning-icon> component inside the <button> element.\",\n \"ensureButtonClasses\": \"Add or move slds-button and slds-button_icon to the class attribute of the <button> element or <lightning-button-icon> component.\",\n \"ensureSizeAttribute\": \"To size icons properly, set the size attribute \u200Cto large in the <lightning-icon> and <lightning-button-icon> components.\"\n }\n },\n \"no-deprecated-classes-slds2\": {\n \"description\": \"Replace classes that aren't available with SLDS 2 classes\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-classes-slds2\",\n \"type\": \"problem\",\n \"messages\": {\n \"deprecatedClass\": \"The class {{className}} isn't available in SLDS 2. Update it to a class supported in SLDS 2. See lightningdesignsystem.com for more information.\",\n \"updateToModernClass\": \"Replace deprecated class with modern equivalent\",\n \"checkDocumentation\": \"See lightningdesignsystem.com for SLDS 2 class alternatives\"\n }\n },\n \"lwc-token-to-slds-hook\": {\n \"description\": \"Replace the deprecated --lwc tokens with the latest --slds tokens. See lightningdesignsystem.com for more info.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#lwc-token-to-slds-hook\",\n \"type\": \"problem\",\n \"messages\": {\n \"errorWithReplacement\": \"The '{{oldValue}}' design token is deprecated. Replace it with '{{newValue}}'. For more info, see Global Styling Hooks on lightningdesignsystem.com.\",\n \"errorWithStyleHooks\": \"The '{{oldValue}}' design token is deprecated. Replace it with the SLDS 2 '{{newValue}}' styling hook and set the fallback to '{{oldValue}}'. For more info, see Global Styling Hooks on lightningdesignsystem.com.\",\n \"errorWithNoRecommendation\": \"The '{{oldValue}}' design token is deprecated. For more info, see the New Global Styling Hook Guidance on lightningdesignsystem.com.\"\n }\n },\n \"no-sldshook-fallback-for-lwctoken\": {\n \"description\": \"Avoid using --slds styling hooks as fallback values for --lwc tokens.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-sldshook-fallback-for-lwctoken\",\n \"type\": \"problem\",\n \"messages\": {\n \"unsupportedFallback\": \"Remove the {{sldsToken}} styling hook that is used as a fallback value for {{lwcToken}}.\"\n }\n },\n \"no-unsupported-hooks-slds2\": {\n \"description\": \"Identifies styling hooks that aren't present in SLDS 2. They must be replaced with styling hooks that have a similar effect, or they must be removed.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-unsupported-hooks-slds2\",\n \"type\": \"problem\",\n \"messages\": {\n \"deprecated\": \"The {{token}} styling hook isn't present in SLDS 2 and there's no equivalent replacement. Remove it or replace it with a styling hook with a similar effect.\"\n }\n },\n \"no-slds-var-without-fallback\": {\n \"description\": \"Add fallback values to SLDS styling hooks. The fallback values are used in Salesforce environments where styling hooks are unavailable.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-var-without-fallback\",\n \"type\": \"problem\",\n \"messages\": {\n \"varWithoutFallback\": \"Your code uses the {{cssVar}} styling hook without a fallback value. Styling hooks are unavailable in some Salesforce environments. To render your component correctly in all environments, add this fallback value: var({{cssVar}}, {{recommendation}}). To make this fallback value brand-aware, use a branded design token instead of a static value. See Design Tokens on v1.lightningdesignsystem.com.\"\n }\n },\n \"no-slds-namespace-for-custom-hooks\": {\n \"description\": \"To differentiate custom styling hooks from SLDS styling hooks, create custom styling hooks in your namespace.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-namespace-for-custom-hooks\",\n \"type\": \"problem\",\n \"messages\": {\n \"customHookNamespace\": \"Using the --slds namespace for {{token}} isn't supported. Create the custom styling hook in your namespace. Example: --myapp-{{tokenWithoutNamespace}}\"\n }\n },\n \"no-slds-private-var\": {\n \"description\": \"Some SLDS styling hooks are private and reserved only for internal Salesforce use. Private SLDS styling hooks have prefixes --_slds- and --slds-s-. For more information, look up private CSS in lightningdesignsystem.com.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-private-var\",\n \"type\": \"problem\",\n \"messages\": {\n \"privateVar\": \"This styling hook is reserved for internal Salesforce use. Remove the --_slds- or \u2013slds-s private variable within selector {{prop}}. For more information, look up private CSS in lightningdesignsystem.com.\"\n }\n },\n \"enforce-component-hook-naming-convention\": {\n \"description\": \"Replace component styling hooks that use a deprecated naming convention.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-component-hook-naming-convention\",\n \"type\": \"problem\",\n \"messages\": {\n \"replace\": \"Replace the deprecated {{oldValue}} component styling hook with {{suggestedMatch}}.\"\n }\n },\n \"no-hardcoded-values-slds1\": {\n \"description\": \"Replace static values with SLDS 1 design tokens. For more information, look up design tokens on lightningdesignsystem.com.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-hardcoded-value\",\n \"type\": \"suggestion\",\n \"messages\": {\n \"hardcodedValue\": \"Replace the {{oldValue}} static value with an SLDS 1 styling hook: {{newValue}}.\",\n \"noReplacement\": \"There's no replacement styling hook for the {{oldValue}} static value. Remove the static value.\"\n }\n },\n \"no-hardcoded-values-slds2\": {\n \"description\": \"Replace static values with SLDS 2 styling hooks. For more information, look up design tokens on lightningdesignsystem.com.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-hardcoded-values-slds2\",\n \"type\": \"suggestion\",\n \"messages\": {\n \"hardcodedValue\": \"Consider replacing the {{oldValue}} static value with an SLDS 2 styling hook that has a similar value: {{newValue}}.\",\n \"noReplacement\": \"There's no replacement styling hook for the {{oldValue}} static value. Remove the static value.\"\n }\n },\n \"reduce-annotations\": {\n \"description\": \"Remove your annotations and update your code.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#reduce-annotations\",\n \"type\": \"problem\",\n \"messages\": {\n \"removeAnnotation\": \"Remove this annotation and update the code to SLDS best practices. For help, file an issue at https://github.com/salesforce-ux/slds-linter/\"\n }\n }\n};", "import { Rule } from 'eslint';\nimport metadata from '@salesforce-ux/sds-metadata/next';\nimport ruleMessages from '../../config/rule-messages.yml';\n\nconst {type, description, url, messages} = ruleMessages['no-deprecated-slds-classes'];\n\nconst deprecatedClasses = metadata.deprecatedClasses;\nconst deprecatedClassesSet = new Set(deprecatedClasses);\n\nexport default {\n meta: {\n type,\n docs: {\n description,\n recommended: true,\n url,\n },\n messages,\n },\n \n create(context) {\n return {\n // For no-deprecated-slds-classes: Check all class selectors for deprecated classes\n \"SelectorList Selector ClassSelector\"(node) {\n const cssClassSelector = context.sourceCode.getText(node);\n \n // Extract class name (remove the leading dot)\n const className = cssClassSelector.substring(1);\n \n // Check if it's a deprecated SLDS class\n if (className && deprecatedClassesSet.has(className)) {\n context.report({\n node,\n messageId: 'deprecatedClass',\n data: { className },\n });\n }\n },\n };\n },\n} as Rule.RuleModule;\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/rules/v9/no-deprecated-slds-classes.ts"],
|
|
4
|
+
"sourcesContent": ["import { Rule } from 'eslint';\nimport metadata from '@salesforce-ux/sds-metadata/next';\nimport ruleMessages from '../../config/rule-messages';\n\nconst {type, description, url, messages} = ruleMessages['no-deprecated-slds-classes'];\n\nconst deprecatedClasses = metadata.deprecatedClasses;\nconst deprecatedClassesSet = new Set(deprecatedClasses);\n\nexport default {\n meta: {\n type,\n docs: {\n description,\n recommended: true,\n url,\n },\n messages,\n },\n \n create(context) {\n return {\n // For no-deprecated-slds-classes: Check all class selectors for deprecated classes\n \"SelectorList Selector ClassSelector\"(node) {\n const cssClassSelector = context.sourceCode.getText(node);\n \n // Extract class name (remove the leading dot)\n const className = cssClassSelector.substring(1);\n \n // Check if it's a deprecated SLDS class\n if (className && deprecatedClassesSet.has(className)) {\n context.report({\n node,\n messageId: 'deprecatedClass',\n data: { className },\n });\n }\n },\n };\n },\n} as Rule.RuleModule;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAqB;AACrB,2BAAyB;AAEzB,IAAM,EAAC,MAAM,aAAa,KAAK,SAAQ,IAAI,qBAAAA,QAAa,4BAA4B;AAEpF,IAAM,oBAAoB,YAAAC,QAAS;AACnC,IAAM,uBAAuB,IAAI,IAAI,iBAAiB;AAEtD,IAAO,qCAAQ;AAAA,EACb,MAAM;AAAA,IACJ;AAAA,IACA,MAAM;AAAA,MACJ;AAAA,MACA,aAAa;AAAA,MACb;AAAA,IACF;AAAA,IACA;AAAA,EACF;AAAA,EAEA,OAAO,SAAS;AACd,WAAO;AAAA;AAAA,MAEL,sCAAsC,MAAM;AAC1C,cAAM,mBAAmB,QAAQ,WAAW,QAAQ,IAAI;AAGxD,cAAM,YAAY,iBAAiB,UAAU,CAAC;AAG9C,YAAI,aAAa,qBAAqB,IAAI,SAAS,GAAG;AACpD,kBAAQ,OAAO;AAAA,YACb;AAAA,YACA,WAAW;AAAA,YACX,MAAM,EAAE,UAAU;AAAA,UACpB,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["ruleMessages", "metadata"]
|
|
7
7
|
}
|
|
@@ -4,9 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
7
|
var __export = (target, all) => {
|
|
11
8
|
for (var name in all)
|
|
12
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -29,163 +26,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
26
|
));
|
|
30
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
28
|
|
|
32
|
-
// yaml-file:rule-messages.yml
|
|
33
|
-
var require_rule_messages = __commonJS({
|
|
34
|
-
"yaml-file:rule-messages.yml"(exports2, module2) {
|
|
35
|
-
module2.exports = {
|
|
36
|
-
"no-slds-class-overrides": {
|
|
37
|
-
"description": "Create new custom CSS classes instead of overriding SLDS selectors",
|
|
38
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-class-overrides",
|
|
39
|
-
"type": "problem",
|
|
40
|
-
"messages": {
|
|
41
|
-
"sldsClassOverride": "Overriding .{{className}} isn't supported. To differentiate SLDS and custom classes, create a CSS class in your namespace. Examples: myapp-input, myapp-button."
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"no-deprecated-slds-classes": {
|
|
45
|
-
"description": "Please replace the deprecated classes with a modern equivalent",
|
|
46
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-slds-classes",
|
|
47
|
-
"type": "problem",
|
|
48
|
-
"messages": {
|
|
49
|
-
"deprecatedClass": "The class {{className}} is deprecated and not available in SLDS2. Please update to a supported class."
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"no-deprecated-tokens-slds1": {
|
|
53
|
-
"description": "Update outdated design tokens to SLDS 2 styling hooks with similar values. For more information, see Styling Hooks on lightningdesignsystem.com.",
|
|
54
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-tokens-slds1",
|
|
55
|
-
"type": "problem",
|
|
56
|
-
"messages": {
|
|
57
|
-
"deprecatedToken": "Consider removing {{oldValue}} or replacing it with {{newValue}}. Set the fallback to {{oldValue}}. For more info, see Styling Hooks on lightningdesignsystem.com.",
|
|
58
|
-
"noReplacement": "Update outdated design tokens to SLDS 2 styling hooks with similar values. For more information, see Styling Hooks on lightningdesignsystem.com."
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"enforce-sds-to-slds-hooks": {
|
|
62
|
-
"description": "Convert your existing --sds styling hooks to --slds styling hooks. See lightningdesignsystem.com for more info.",
|
|
63
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-sds-to-slds-hooks",
|
|
64
|
-
"type": "problem",
|
|
65
|
-
"messages": {
|
|
66
|
-
"replaceSdsWithSlds": "Replace {{oldValue}} with {{suggestedMatch}} styling hook."
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"enforce-bem-usage": {
|
|
70
|
-
"description": "Replace BEM double-dash syntax in class names with single underscore syntax",
|
|
71
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-bem-usage",
|
|
72
|
-
"type": "problem",
|
|
73
|
-
"messages": {
|
|
74
|
-
"bemDoubleDash": "{{actual}} has been retired. Update it to the new name {{newValue}}.",
|
|
75
|
-
"fixBemNaming": "Update to correct BEM naming convention"
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
"modal-close-button-issue": {
|
|
79
|
-
"description": "Update component attributes or CSS classes for the modal close button to comply with the modal component blueprint",
|
|
80
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#modal-close-button-issue",
|
|
81
|
-
"type": "problem",
|
|
82
|
-
"messages": {
|
|
83
|
-
"modalCloseButtonIssue": "Update component attributes or CSS classes for the modal close button to comply with the modal component blueprint.",
|
|
84
|
-
"removeClass": "Remove the slds-button_icon-inverse class from the modal close button in components that use the SLDS modal blueprint.",
|
|
85
|
-
"changeVariant": "Change the variant attribute value from bare-inverse to bare in <lightning-button-icon> or <lightning-icon>.",
|
|
86
|
-
"removeVariant": "Remove the variant attribute from the <lightning-icon> component inside the <button> element.",
|
|
87
|
-
"ensureButtonClasses": "Add or move slds-button and slds-button_icon to the class attribute of the <button> element or <lightning-button-icon> component.",
|
|
88
|
-
"ensureSizeAttribute": "To size icons properly, set the size attribute \u200Cto large in the <lightning-icon> and <lightning-button-icon> components."
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"no-deprecated-classes-slds2": {
|
|
92
|
-
"description": "Replace classes that aren't available with SLDS 2 classes",
|
|
93
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-classes-slds2",
|
|
94
|
-
"type": "problem",
|
|
95
|
-
"messages": {
|
|
96
|
-
"deprecatedClass": "The class {{className}} isn't available in SLDS 2. Update it to a class supported in SLDS 2. See lightningdesignsystem.com for more information.",
|
|
97
|
-
"updateToModernClass": "Replace deprecated class with modern equivalent",
|
|
98
|
-
"checkDocumentation": "See lightningdesignsystem.com for SLDS 2 class alternatives"
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
"lwc-token-to-slds-hook": {
|
|
102
|
-
"description": "Replace the deprecated --lwc tokens with the latest --slds tokens. See lightningdesignsystem.com for more info.",
|
|
103
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#lwc-token-to-slds-hook",
|
|
104
|
-
"type": "problem",
|
|
105
|
-
"messages": {
|
|
106
|
-
"errorWithReplacement": "The '{{oldValue}}' design token is deprecated. Replace it with '{{newValue}}'. For more info, see Global Styling Hooks on lightningdesignsystem.com.",
|
|
107
|
-
"errorWithStyleHooks": "The '{{oldValue}}' design token is deprecated. Replace it with the SLDS 2 '{{newValue}}' styling hook and set the fallback to '{{oldValue}}'. For more info, see Global Styling Hooks on lightningdesignsystem.com.",
|
|
108
|
-
"errorWithNoRecommendation": "The '{{oldValue}}' design token is deprecated. For more info, see the New Global Styling Hook Guidance on lightningdesignsystem.com."
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
"no-sldshook-fallback-for-lwctoken": {
|
|
112
|
-
"description": "Avoid using --slds styling hooks as fallback values for --lwc tokens.",
|
|
113
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-sldshook-fallback-for-lwctoken",
|
|
114
|
-
"type": "problem",
|
|
115
|
-
"messages": {
|
|
116
|
-
"unsupportedFallback": "Remove the {{sldsToken}} styling hook that is used as a fallback value for {{lwcToken}}."
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
"no-unsupported-hooks-slds2": {
|
|
120
|
-
"description": "Identifies styling hooks that aren't present in SLDS 2. They must be replaced with styling hooks that have a similar effect, or they must be removed.",
|
|
121
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-unsupported-hooks-slds2",
|
|
122
|
-
"type": "problem",
|
|
123
|
-
"messages": {
|
|
124
|
-
"deprecated": "The {{token}} styling hook isn't present in SLDS 2 and there's no equivalent replacement. Remove it or replace it with a styling hook with a similar effect."
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
"no-slds-var-without-fallback": {
|
|
128
|
-
"description": "Add fallback values to SLDS styling hooks. The fallback values are used in Salesforce environments where styling hooks are unavailable.",
|
|
129
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-var-without-fallback",
|
|
130
|
-
"type": "problem",
|
|
131
|
-
"messages": {
|
|
132
|
-
"varWithoutFallback": "Your code uses the {{cssVar}} styling hook without a fallback value. Styling hooks are unavailable in some Salesforce environments. To render your component correctly in all environments, add this fallback value: var({{cssVar}}, {{recommendation}}). To make this fallback value brand-aware, use a branded design token instead of a static value. See Design Tokens on v1.lightningdesignsystem.com."
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
"no-slds-namespace-for-custom-hooks": {
|
|
136
|
-
"description": "To differentiate custom styling hooks from SLDS styling hooks, create custom styling hooks in your namespace.",
|
|
137
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-namespace-for-custom-hooks",
|
|
138
|
-
"type": "problem",
|
|
139
|
-
"messages": {
|
|
140
|
-
"customHookNamespace": "Using the --slds namespace for {{token}} isn't supported. Create the custom styling hook in your namespace. Example: --myapp-{{tokenWithoutNamespace}}"
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
"no-slds-private-var": {
|
|
144
|
-
"description": "Some SLDS styling hooks are private and reserved only for internal Salesforce use. Private SLDS styling hooks have prefixes --_slds- and --slds-s-. For more information, look up private CSS in lightningdesignsystem.com.",
|
|
145
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-private-var",
|
|
146
|
-
"type": "problem",
|
|
147
|
-
"messages": {
|
|
148
|
-
"privateVar": "This styling hook is reserved for internal Salesforce use. Remove the --_slds- or \u2013slds-s private variable within selector {{prop}}. For more information, look up private CSS in lightningdesignsystem.com."
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
"enforce-component-hook-naming-convention": {
|
|
152
|
-
"description": "Replace component styling hooks that use a deprecated naming convention.",
|
|
153
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-component-hook-naming-convention",
|
|
154
|
-
"type": "problem",
|
|
155
|
-
"messages": {
|
|
156
|
-
"replace": "Replace the deprecated {{oldValue}} component styling hook with {{suggestedMatch}}."
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
"no-hardcoded-values-slds1": {
|
|
160
|
-
"description": "Replace static values with SLDS 1 design tokens. For more information, look up design tokens on lightningdesignsystem.com.",
|
|
161
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-hardcoded-value",
|
|
162
|
-
"type": "suggestion",
|
|
163
|
-
"messages": {
|
|
164
|
-
"hardcodedValue": "Replace the {{oldValue}} static value with an SLDS 1 styling hook: {{newValue}}.",
|
|
165
|
-
"noReplacement": "There's no replacement styling hook for the {{oldValue}} static value. Remove the static value."
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
"no-hardcoded-values-slds2": {
|
|
169
|
-
"description": "Replace static values with SLDS 2 styling hooks. For more information, look up design tokens on lightningdesignsystem.com.",
|
|
170
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-hardcoded-values-slds2",
|
|
171
|
-
"type": "suggestion",
|
|
172
|
-
"messages": {
|
|
173
|
-
"hardcodedValue": "Consider replacing the {{oldValue}} static value with an SLDS 2 styling hook that has a similar value: {{newValue}}.",
|
|
174
|
-
"noReplacement": "There's no replacement styling hook for the {{oldValue}} static value. Remove the static value."
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
"reduce-annotations": {
|
|
178
|
-
"description": "Remove your annotations and update your code.",
|
|
179
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#reduce-annotations",
|
|
180
|
-
"type": "problem",
|
|
181
|
-
"messages": {
|
|
182
|
-
"removeAnnotation": "Remove this annotation and update the code to SLDS best practices. For help, file an issue at https://github.com/salesforce-ux/slds-linter/"
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
|
|
189
29
|
// src/rules/v9/no-deprecated-tokens-slds1.ts
|
|
190
30
|
var no_deprecated_tokens_slds1_exports = {};
|
|
191
31
|
__export(no_deprecated_tokens_slds1_exports, {
|
|
@@ -193,10 +33,22 @@ __export(no_deprecated_tokens_slds1_exports, {
|
|
|
193
33
|
});
|
|
194
34
|
module.exports = __toCommonJS(no_deprecated_tokens_slds1_exports);
|
|
195
35
|
var import_next = __toESM(require("@salesforce-ux/sds-metadata/next"));
|
|
196
|
-
var import_rule_messages = __toESM(
|
|
36
|
+
var import_rule_messages = __toESM(require("../../config/rule-messages"));
|
|
197
37
|
var ruleConfig = import_rule_messages.default["no-deprecated-tokens-slds1"];
|
|
198
38
|
var { type, description, url, messages } = ruleConfig;
|
|
199
|
-
var
|
|
39
|
+
var auraToLwc = import_next.default.auraToLwcTokensMapping;
|
|
40
|
+
var lwcToSlds = import_next.default.lwcToSlds;
|
|
41
|
+
var globalStylingHooksMetadata = import_next.default.globalStylingHooksMetadata?.global || {};
|
|
42
|
+
function getSldsHookFallbackValue(sldsHook) {
|
|
43
|
+
const value = globalStylingHooksMetadata[sldsHook]?.values?.slds;
|
|
44
|
+
if (!value) return null;
|
|
45
|
+
if (!value.startsWith("var(")) return value;
|
|
46
|
+
const innerSldsHook = value.match(/(--slds-[\w-]+)/)?.[1];
|
|
47
|
+
if (innerSldsHook) {
|
|
48
|
+
return globalStylingHooksMetadata[innerSldsHook]?.values?.slds || null;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
200
52
|
var no_deprecated_tokens_slds1_default = {
|
|
201
53
|
meta: {
|
|
202
54
|
type,
|
|
@@ -210,14 +62,23 @@ var no_deprecated_tokens_slds1_default = {
|
|
|
210
62
|
},
|
|
211
63
|
create(context) {
|
|
212
64
|
function shouldIgnoreDetection(token) {
|
|
213
|
-
return !(token in
|
|
65
|
+
return !(token in auraToLwc) || !auraToLwc[token].startsWith("--lwc-");
|
|
214
66
|
}
|
|
215
|
-
function generateReplacement(tokenName
|
|
216
|
-
|
|
67
|
+
function generateReplacement(tokenName) {
|
|
68
|
+
const lwcToken = auraToLwc[tokenName];
|
|
69
|
+
if (!lwcToken || !lwcToken.startsWith("--lwc-")) {
|
|
217
70
|
return null;
|
|
218
71
|
}
|
|
219
|
-
const
|
|
220
|
-
|
|
72
|
+
const sldsMapping = lwcToSlds[lwcToken];
|
|
73
|
+
if (sldsMapping) {
|
|
74
|
+
const sldsHook = sldsMapping.replacement;
|
|
75
|
+
if (typeof sldsHook === "string" && sldsHook.startsWith("--slds-")) {
|
|
76
|
+
const fallbackValue = getSldsHookFallbackValue(sldsHook);
|
|
77
|
+
const lwcFallback = fallbackValue ? `var(${lwcToken}, ${fallbackValue})` : `var(${lwcToken})`;
|
|
78
|
+
return `var(${sldsHook}, ${lwcFallback})`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return `var(${lwcToken})`;
|
|
221
82
|
}
|
|
222
83
|
function handleTokenFunction(node, functionName) {
|
|
223
84
|
const tokenName = context.sourceCode.getText(node);
|
|
@@ -225,7 +86,7 @@ var no_deprecated_tokens_slds1_default = {
|
|
|
225
86
|
return;
|
|
226
87
|
}
|
|
227
88
|
const originalFunctionCall = `${functionName}(${tokenName})`;
|
|
228
|
-
const replacement = generateReplacement(tokenName
|
|
89
|
+
const replacement = generateReplacement(tokenName);
|
|
229
90
|
if (replacement) {
|
|
230
91
|
context.report({
|
|
231
92
|
node,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
4
|
-
"sourcesContent": ["module.exports = {\n \"no-slds-class-overrides\": {\n \"description\": \"Create new custom CSS classes instead of overriding SLDS selectors\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-class-overrides\",\n \"type\": \"problem\",\n \"messages\": {\n \"sldsClassOverride\": \"Overriding .{{className}} isn't supported. To differentiate SLDS and custom classes, create a CSS class in your namespace. Examples: myapp-input, myapp-button.\"\n }\n },\n \"no-deprecated-slds-classes\": {\n \"description\": \"Please replace the deprecated classes with a modern equivalent\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-slds-classes\",\n \"type\": \"problem\",\n \"messages\": {\n \"deprecatedClass\": \"The class {{className}} is deprecated and not available in SLDS2. Please update to a supported class.\"\n }\n },\n \"no-deprecated-tokens-slds1\": {\n \"description\": \"Update outdated design tokens to SLDS 2 styling hooks with similar values. For more information, see Styling Hooks on lightningdesignsystem.com.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-tokens-slds1\",\n \"type\": \"problem\",\n \"messages\": {\n \"deprecatedToken\": \"Consider removing {{oldValue}} or replacing it with {{newValue}}. Set the fallback to {{oldValue}}. For more info, see Styling Hooks on lightningdesignsystem.com.\",\n \"noReplacement\": \"Update outdated design tokens to SLDS 2 styling hooks with similar values. For more information, see Styling Hooks on lightningdesignsystem.com.\"\n }\n },\n \"enforce-sds-to-slds-hooks\": {\n \"description\": \"Convert your existing --sds styling hooks to --slds styling hooks. See lightningdesignsystem.com for more info.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-sds-to-slds-hooks\",\n \"type\": \"problem\",\n \"messages\": {\n \"replaceSdsWithSlds\": \"Replace {{oldValue}} with {{suggestedMatch}} styling hook.\"\n }\n },\n \"enforce-bem-usage\": {\n \"description\": \"Replace BEM double-dash syntax in class names with single underscore syntax\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-bem-usage\",\n \"type\": \"problem\",\n \"messages\": {\n \"bemDoubleDash\": \"{{actual}} has been retired. Update it to the new name {{newValue}}.\",\n \"fixBemNaming\": \"Update to correct BEM naming convention\"\n }\n },\n \"modal-close-button-issue\": {\n \"description\": \"Update component attributes or CSS classes for the modal close button to comply with the modal component blueprint\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#modal-close-button-issue\",\n \"type\": \"problem\",\n \"messages\": {\n \"modalCloseButtonIssue\": \"Update component attributes or CSS classes for the modal close button to comply with the modal component blueprint.\",\n \"removeClass\": \"Remove the slds-button_icon-inverse class from the modal close button in components that use the SLDS modal blueprint.\",\n \"changeVariant\": \"Change the variant attribute value from bare-inverse to bare in <lightning-button-icon> or <lightning-icon>.\",\n \"removeVariant\": \"Remove the variant attribute from the <lightning-icon> component inside the <button> element.\",\n \"ensureButtonClasses\": \"Add or move slds-button and slds-button_icon to the class attribute of the <button> element or <lightning-button-icon> component.\",\n \"ensureSizeAttribute\": \"To size icons properly, set the size attribute \u200Cto large in the <lightning-icon> and <lightning-button-icon> components.\"\n }\n },\n \"no-deprecated-classes-slds2\": {\n \"description\": \"Replace classes that aren't available with SLDS 2 classes\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-classes-slds2\",\n \"type\": \"problem\",\n \"messages\": {\n \"deprecatedClass\": \"The class {{className}} isn't available in SLDS 2. Update it to a class supported in SLDS 2. See lightningdesignsystem.com for more information.\",\n \"updateToModernClass\": \"Replace deprecated class with modern equivalent\",\n \"checkDocumentation\": \"See lightningdesignsystem.com for SLDS 2 class alternatives\"\n }\n },\n \"lwc-token-to-slds-hook\": {\n \"description\": \"Replace the deprecated --lwc tokens with the latest --slds tokens. See lightningdesignsystem.com for more info.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#lwc-token-to-slds-hook\",\n \"type\": \"problem\",\n \"messages\": {\n \"errorWithReplacement\": \"The '{{oldValue}}' design token is deprecated. Replace it with '{{newValue}}'. For more info, see Global Styling Hooks on lightningdesignsystem.com.\",\n \"errorWithStyleHooks\": \"The '{{oldValue}}' design token is deprecated. Replace it with the SLDS 2 '{{newValue}}' styling hook and set the fallback to '{{oldValue}}'. For more info, see Global Styling Hooks on lightningdesignsystem.com.\",\n \"errorWithNoRecommendation\": \"The '{{oldValue}}' design token is deprecated. For more info, see the New Global Styling Hook Guidance on lightningdesignsystem.com.\"\n }\n },\n \"no-sldshook-fallback-for-lwctoken\": {\n \"description\": \"Avoid using --slds styling hooks as fallback values for --lwc tokens.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-sldshook-fallback-for-lwctoken\",\n \"type\": \"problem\",\n \"messages\": {\n \"unsupportedFallback\": \"Remove the {{sldsToken}} styling hook that is used as a fallback value for {{lwcToken}}.\"\n }\n },\n \"no-unsupported-hooks-slds2\": {\n \"description\": \"Identifies styling hooks that aren't present in SLDS 2. They must be replaced with styling hooks that have a similar effect, or they must be removed.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-unsupported-hooks-slds2\",\n \"type\": \"problem\",\n \"messages\": {\n \"deprecated\": \"The {{token}} styling hook isn't present in SLDS 2 and there's no equivalent replacement. Remove it or replace it with a styling hook with a similar effect.\"\n }\n },\n \"no-slds-var-without-fallback\": {\n \"description\": \"Add fallback values to SLDS styling hooks. The fallback values are used in Salesforce environments where styling hooks are unavailable.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-var-without-fallback\",\n \"type\": \"problem\",\n \"messages\": {\n \"varWithoutFallback\": \"Your code uses the {{cssVar}} styling hook without a fallback value. Styling hooks are unavailable in some Salesforce environments. To render your component correctly in all environments, add this fallback value: var({{cssVar}}, {{recommendation}}). To make this fallback value brand-aware, use a branded design token instead of a static value. See Design Tokens on v1.lightningdesignsystem.com.\"\n }\n },\n \"no-slds-namespace-for-custom-hooks\": {\n \"description\": \"To differentiate custom styling hooks from SLDS styling hooks, create custom styling hooks in your namespace.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-namespace-for-custom-hooks\",\n \"type\": \"problem\",\n \"messages\": {\n \"customHookNamespace\": \"Using the --slds namespace for {{token}} isn't supported. Create the custom styling hook in your namespace. Example: --myapp-{{tokenWithoutNamespace}}\"\n }\n },\n \"no-slds-private-var\": {\n \"description\": \"Some SLDS styling hooks are private and reserved only for internal Salesforce use. Private SLDS styling hooks have prefixes --_slds- and --slds-s-. For more information, look up private CSS in lightningdesignsystem.com.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-private-var\",\n \"type\": \"problem\",\n \"messages\": {\n \"privateVar\": \"This styling hook is reserved for internal Salesforce use. Remove the --_slds- or \u2013slds-s private variable within selector {{prop}}. For more information, look up private CSS in lightningdesignsystem.com.\"\n }\n },\n \"enforce-component-hook-naming-convention\": {\n \"description\": \"Replace component styling hooks that use a deprecated naming convention.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-component-hook-naming-convention\",\n \"type\": \"problem\",\n \"messages\": {\n \"replace\": \"Replace the deprecated {{oldValue}} component styling hook with {{suggestedMatch}}.\"\n }\n },\n \"no-hardcoded-values-slds1\": {\n \"description\": \"Replace static values with SLDS 1 design tokens. For more information, look up design tokens on lightningdesignsystem.com.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-hardcoded-value\",\n \"type\": \"suggestion\",\n \"messages\": {\n \"hardcodedValue\": \"Replace the {{oldValue}} static value with an SLDS 1 styling hook: {{newValue}}.\",\n \"noReplacement\": \"There's no replacement styling hook for the {{oldValue}} static value. Remove the static value.\"\n }\n },\n \"no-hardcoded-values-slds2\": {\n \"description\": \"Replace static values with SLDS 2 styling hooks. For more information, look up design tokens on lightningdesignsystem.com.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-hardcoded-values-slds2\",\n \"type\": \"suggestion\",\n \"messages\": {\n \"hardcodedValue\": \"Consider replacing the {{oldValue}} static value with an SLDS 2 styling hook that has a similar value: {{newValue}}.\",\n \"noReplacement\": \"There's no replacement styling hook for the {{oldValue}} static value. Remove the static value.\"\n }\n },\n \"reduce-annotations\": {\n \"description\": \"Remove your annotations and update your code.\",\n \"url\": \"https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#reduce-annotations\",\n \"type\": \"problem\",\n \"messages\": {\n \"removeAnnotation\": \"Remove this annotation and update the code to SLDS best practices. For help, file an issue at https://github.com/salesforce-ux/slds-linter/\"\n }\n }\n};", "import { Rule } from 'eslint';\nimport metadata from '@salesforce-ux/sds-metadata/next';\nimport ruleMessages from '../../config/rule-messages.yml';\n\nconst ruleConfig = ruleMessages['no-deprecated-tokens-slds1'];\nconst { type, description, url, messages } = ruleConfig;\n\n// Get token mapping from metadata (Aura tokens to LWC tokens)\nconst tokenMapping = metadata.auraToLwcTokensMapping;\n\nexport default {\n meta: {\n type,\n docs: {\n description: description,\n recommended: true,\n url,\n },\n fixable: 'code',\n messages,\n },\n \n create(context) {\n /**\n * Check if a token should be ignored (not in mapping or not LWC token)\n */\n function shouldIgnoreDetection(token: string): boolean {\n return (!(token in tokenMapping) || !tokenMapping[token].startsWith('--lwc-'));\n }\n\n /**\n * Generate replacement suggestion for deprecated token\n */\n function generateReplacement(tokenName: string, originalFunctionCall: string): string | null {\n if (shouldIgnoreDetection(tokenName)) {\n return null;\n }\n const recommendation = tokenMapping[tokenName];\n return `var(${recommendation}, ${originalFunctionCall})`;\n }\n\n function handleTokenFunction(node, functionName) {\n // Get the token name from the identifier\n const tokenName = context.sourceCode.getText(node);\n \n // Skip if token should be ignored\n if (shouldIgnoreDetection(tokenName)) {\n return;\n }\n\n // Create original function call - mirroring stylelint's approach\n const originalFunctionCall = `${functionName}(${tokenName})`;\n const replacement = generateReplacement(tokenName, originalFunctionCall);\n \n if (replacement) {\n // Report with replacement suggestion\n context.report({\n node,\n messageId: 'deprecatedToken',\n data: { \n oldValue: originalFunctionCall,\n newValue: replacement\n },\n fix(fixer) {\n // Use node position to avoid multiple replacements of same token\n const sourceCode = context.sourceCode.getText();\n const tokenFunctionCall = `${functionName}(${tokenName})`;\n const nodeOffset = node.loc.start.offset;\n \n // Search backwards from the node position to find the function start\n const searchStart = Math.max(0, nodeOffset - functionName.length - 1);\n const searchEnd = nodeOffset + tokenName.length + 1;\n const searchArea = sourceCode.substring(searchStart, searchEnd);\n \n const functionCallIndex = searchArea.indexOf(tokenFunctionCall);\n if (functionCallIndex !== -1) {\n const actualStart = searchStart + functionCallIndex;\n const actualEnd = actualStart + tokenFunctionCall.length;\n return fixer.replaceTextRange([actualStart, actualEnd], replacement);\n }\n return null;\n }\n });\n } else {\n // Report without specific replacement\n context.report({\n node,\n messageId: 'noReplacement',\n });\n }\n }\n\n return {\n \"Function[name='token'] Identifier\"(node) {\n handleTokenFunction(node, 'token');\n },\n \"Function[name='t'] Identifier\"(node) {\n handleTokenFunction(node, 't');\n },\n };\n\n },\n} as Rule.RuleModule;\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/rules/v9/no-deprecated-tokens-slds1.ts"],
|
|
4
|
+
"sourcesContent": ["import { Rule } from 'eslint';\nimport metadata from '@salesforce-ux/sds-metadata/next';\nimport ruleMessages from '../../config/rule-messages';\n\nconst ruleConfig = ruleMessages['no-deprecated-tokens-slds1'];\nconst { type, description, url, messages } = ruleConfig;\n\n// Get both mappings to chain Aura \u2192 LWC \u2192 SLDS\nconst auraToLwc = metadata.auraToLwcTokensMapping;\nconst lwcToSlds = metadata.lwcToSlds;\nconst globalStylingHooksMetadata = metadata.globalStylingHooksMetadata?.global || {};\n\n/**\n * Get fallback value (numeric/color) for an SLDS hook from metadata.\n * Handles two patterns in metadata:\n * 1. Raw value: \"#757575\" \u2192 returns as-is\n * 2. Nested var: \"var(--lwc-*, var(--slds-*))\" \u2192 looks up the inner SLDS hook's value\n */\nfunction getSldsHookFallbackValue(sldsHook: string): string | null {\n const value = globalStylingHooksMetadata[sldsHook]?.values?.slds;\n if (!value) return null;\n \n // If raw value, return directly\n if (!value.startsWith('var(')) return value;\n \n // Value is \"var(--lwc-*, var(--slds-*))\" - extract the inner --slds-* hook\n const innerSldsHook = value.match(/(--slds-[\\w-]+)/)?.[1];\n if (innerSldsHook) {\n return globalStylingHooksMetadata[innerSldsHook]?.values?.slds || null;\n }\n \n return null;\n}\n\nexport default {\n meta: {\n type,\n docs: {\n description: description,\n recommended: true,\n url,\n },\n fixable: 'code',\n messages,\n },\n \n create(context) {\n /**\n * Check if a token should be ignored (not in mapping or not LWC token)\n */\n function shouldIgnoreDetection(token: string): boolean {\n return !(token in auraToLwc) || !auraToLwc[token].startsWith('--lwc-');\n }\n\n /**\n * Generate replacement - directly to SLDS with LWC fallback (removes t())\n * Output format: var(--slds-*, var(--lwc-*, fallback)) or var(--lwc-*, fallback) if no SLDS mapping\n */\n function generateReplacement(tokenName: string): string | null {\n const lwcToken = auraToLwc[tokenName];\n if (!lwcToken || !lwcToken.startsWith('--lwc-')) {\n return null;\n }\n \n const sldsMapping = lwcToSlds[lwcToken];\n \n // If SLDS mapping exists and is a direct token replacement\n if (sldsMapping) {\n const sldsHook = sldsMapping.replacement;\n if (typeof sldsHook === 'string' && sldsHook.startsWith('--slds-')) {\n // Get fallback value from SLDS hook metadata\n const fallbackValue = getSldsHookFallbackValue(sldsHook);\n // Final format: var(--slds-*, var(--lwc-*, fallback)) or var(--slds-*, var(--lwc-*))\n const lwcFallback = fallbackValue \n ? `var(${lwcToken}, ${fallbackValue})`\n : `var(${lwcToken})`;\n return `var(${sldsHook}, ${lwcFallback})`;\n }\n }\n \n // No SLDS mapping: just LWC token without t()\n return `var(${lwcToken})`;\n }\n\n function handleTokenFunction(node, functionName) {\n // Get the token name from the identifier\n const tokenName = context.sourceCode.getText(node);\n \n // Skip if token should be ignored\n if (shouldIgnoreDetection(tokenName)) {\n return;\n }\n\n // Create original function call for error message\n const originalFunctionCall = `${functionName}(${tokenName})`;\n const replacement = generateReplacement(tokenName);\n \n if (replacement) {\n // Report with replacement suggestion\n context.report({\n node,\n messageId: 'deprecatedToken',\n data: { \n oldValue: originalFunctionCall,\n newValue: replacement\n },\n fix(fixer) {\n // Use node position to avoid multiple replacements of same token\n const sourceCode = context.sourceCode.getText();\n const tokenFunctionCall = `${functionName}(${tokenName})`;\n const nodeOffset = node.loc.start.offset;\n \n // Search backwards from the node position to find the function start\n const searchStart = Math.max(0, nodeOffset - functionName.length - 1);\n const searchEnd = nodeOffset + tokenName.length + 1;\n const searchArea = sourceCode.substring(searchStart, searchEnd);\n \n const functionCallIndex = searchArea.indexOf(tokenFunctionCall);\n if (functionCallIndex !== -1) {\n const actualStart = searchStart + functionCallIndex;\n const actualEnd = actualStart + tokenFunctionCall.length;\n return fixer.replaceTextRange([actualStart, actualEnd], replacement);\n }\n return null;\n }\n });\n } else {\n // Report without specific replacement\n context.report({\n node,\n messageId: 'noReplacement',\n });\n }\n }\n\n return {\n \"Function[name='token'] Identifier\"(node) {\n handleTokenFunction(node, 'token');\n },\n \"Function[name='t'] Identifier\"(node) {\n handleTokenFunction(node, 't');\n },\n };\n\n },\n} as Rule.RuleModule;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAqB;AACrB,2BAAyB;AAEzB,IAAM,aAAa,qBAAAA,QAAa,4BAA4B;AAC5D,IAAM,EAAE,MAAM,aAAa,KAAK,SAAS,IAAI;AAG7C,IAAM,YAAY,YAAAC,QAAS;AAC3B,IAAM,YAAY,YAAAA,QAAS;AAC3B,IAAM,6BAA6B,YAAAA,QAAS,4BAA4B,UAAU,CAAC;AAQnF,SAAS,yBAAyB,UAAiC;AACjE,QAAM,QAAQ,2BAA2B,QAAQ,GAAG,QAAQ;AAC5D,MAAI,CAAC,MAAO,QAAO;AAGnB,MAAI,CAAC,MAAM,WAAW,MAAM,EAAG,QAAO;AAGtC,QAAM,gBAAgB,MAAM,MAAM,iBAAiB,IAAI,CAAC;AACxD,MAAI,eAAe;AACjB,WAAO,2BAA2B,aAAa,GAAG,QAAQ,QAAQ;AAAA,EACpE;AAEA,SAAO;AACT;AAEA,IAAO,qCAAQ;AAAA,EACb,MAAM;AAAA,IACJ;AAAA,IACA,MAAM;AAAA,MACJ;AAAA,MACA,aAAa;AAAA,MACb;AAAA,IACF;AAAA,IACA,SAAS;AAAA,IACT;AAAA,EACF;AAAA,EAEA,OAAO,SAAS;AAId,aAAS,sBAAsB,OAAwB;AACrD,aAAO,EAAE,SAAS,cAAc,CAAC,UAAU,KAAK,EAAE,WAAW,QAAQ;AAAA,IACvE;AAMA,aAAS,oBAAoB,WAAkC;AAC7D,YAAM,WAAW,UAAU,SAAS;AACpC,UAAI,CAAC,YAAY,CAAC,SAAS,WAAW,QAAQ,GAAG;AAC/C,eAAO;AAAA,MACT;AAEA,YAAM,cAAc,UAAU,QAAQ;AAGtC,UAAI,aAAa;AACf,cAAM,WAAW,YAAY;AAC7B,YAAI,OAAO,aAAa,YAAY,SAAS,WAAW,SAAS,GAAG;AAElE,gBAAM,gBAAgB,yBAAyB,QAAQ;AAEvD,gBAAM,cAAc,gBAChB,OAAO,QAAQ,KAAK,aAAa,MACjC,OAAO,QAAQ;AACnB,iBAAO,OAAO,QAAQ,KAAK,WAAW;AAAA,QACxC;AAAA,MACF;AAGA,aAAO,OAAO,QAAQ;AAAA,IACxB;AAEA,aAAS,oBAAoB,MAAM,cAAc;AAE/C,YAAM,YAAY,QAAQ,WAAW,QAAQ,IAAI;AAGjD,UAAI,sBAAsB,SAAS,GAAG;AACpC;AAAA,MACF;AAGA,YAAM,uBAAuB,GAAG,YAAY,IAAI,SAAS;AACzD,YAAM,cAAc,oBAAoB,SAAS;AAEjD,UAAI,aAAa;AAEf,gBAAQ,OAAO;AAAA,UACb;AAAA,UACA,WAAW;AAAA,UACX,MAAM;AAAA,YACJ,UAAU;AAAA,YACV,UAAU;AAAA,UACZ;AAAA,UACA,IAAI,OAAO;AAET,kBAAM,aAAa,QAAQ,WAAW,QAAQ;AAC9C,kBAAM,oBAAoB,GAAG,YAAY,IAAI,SAAS;AACtD,kBAAM,aAAa,KAAK,IAAI,MAAM;AAGlC,kBAAM,cAAc,KAAK,IAAI,GAAG,aAAa,aAAa,SAAS,CAAC;AACpE,kBAAM,YAAY,aAAa,UAAU,SAAS;AAClD,kBAAM,aAAa,WAAW,UAAU,aAAa,SAAS;AAE9D,kBAAM,oBAAoB,WAAW,QAAQ,iBAAiB;AAC9D,gBAAI,sBAAsB,IAAI;AAC5B,oBAAM,cAAc,cAAc;AAClC,oBAAM,YAAY,cAAc,kBAAkB;AAClD,qBAAO,MAAM,iBAAiB,CAAC,aAAa,SAAS,GAAG,WAAW;AAAA,YACrE;AACA,mBAAO;AAAA,UACT;AAAA,QACF,CAAC;AAAA,MACH,OAAO;AAEL,gBAAQ,OAAO;AAAA,UACb;AAAA,UACA,WAAW;AAAA,QACb,CAAC;AAAA,MACH;AAAA,IACF;AAEA,WAAO;AAAA,MACL,oCAAoC,MAAM;AACxC,4BAAoB,MAAM,OAAO;AAAA,MACnC;AAAA,MACA,gCAAgC,MAAM;AACpC,4BAAoB,MAAM,GAAG;AAAA,MAC/B;AAAA,IACF;AAAA,EAEF;AACF;",
|
|
6
|
+
"names": ["ruleMessages", "metadata"]
|
|
7
7
|
}
|