@salesforce-ux/eslint-plugin-slds 0.5.2 → 1.0.0-internal-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +2309 -50
- package/build/index.js.map +4 -4
- package/build/rules/enforce-bem-usage.js +325 -85
- package/build/rules/enforce-bem-usage.js.map +4 -4
- package/build/rules/modal-close-button-issue.js +324 -179
- package/build/rules/modal-close-button-issue.js.map +4 -4
- package/build/rules/no-deprecated-classes-slds2.js +247 -53
- package/build/rules/no-deprecated-classes-slds2.js.map +4 -4
- package/build/rules/v9/enforce-bem-usage.js +236 -0
- package/build/rules/v9/enforce-bem-usage.js.map +7 -0
- package/build/rules/v9/enforce-component-hook-naming-convention.js +262 -0
- package/build/rules/v9/enforce-component-hook-naming-convention.js.map +7 -0
- package/build/rules/v9/enforce-sds-to-slds-hooks.js +260 -0
- package/build/rules/v9/enforce-sds-to-slds-hooks.js.map +7 -0
- package/build/rules/v9/lwc-token-to-slds-hook.js +330 -0
- package/build/rules/v9/lwc-token-to-slds-hook.js.map +7 -0
- package/build/rules/v9/no-deprecated-slds-classes.js +227 -0
- package/build/rules/v9/no-deprecated-slds-classes.js.map +7 -0
- package/build/rules/v9/no-deprecated-tokens-slds1.js +270 -0
- package/build/rules/v9/no-deprecated-tokens-slds1.js.map +7 -0
- package/build/rules/v9/no-hardcoded-values/handlers/boxShadowHandler.js +339 -0
- package/build/rules/v9/no-hardcoded-values/handlers/boxShadowHandler.js.map +7 -0
- package/build/rules/v9/no-hardcoded-values/handlers/colorHandler.js +348 -0
- package/build/rules/v9/no-hardcoded-values/handlers/colorHandler.js.map +7 -0
- package/build/rules/v9/no-hardcoded-values/handlers/densityHandler.js +344 -0
- package/build/rules/v9/no-hardcoded-values/handlers/densityHandler.js.map +7 -0
- package/build/rules/v9/no-hardcoded-values/handlers/fontHandler.js +388 -0
- package/build/rules/v9/no-hardcoded-values/handlers/fontHandler.js.map +7 -0
- package/build/rules/v9/no-hardcoded-values/handlers/index.js +834 -0
- package/build/rules/v9/no-hardcoded-values/handlers/index.js.map +7 -0
- package/build/rules/v9/no-hardcoded-values/no-hardcoded-values-slds1.js +1112 -0
- package/build/rules/v9/no-hardcoded-values/no-hardcoded-values-slds1.js.map +7 -0
- package/build/rules/v9/no-hardcoded-values/no-hardcoded-values-slds2.js +1112 -0
- package/build/rules/v9/no-hardcoded-values/no-hardcoded-values-slds2.js.map +7 -0
- package/build/rules/v9/no-hardcoded-values/noHardcodedValueRule.js +945 -0
- package/build/rules/v9/no-hardcoded-values/noHardcodedValueRule.js.map +7 -0
- package/build/rules/v9/no-slds-class-overrides.js +233 -0
- package/build/rules/v9/no-slds-class-overrides.js.map +7 -0
- package/build/rules/v9/no-slds-namespace-for-custom-hooks.js +250 -0
- package/build/rules/v9/no-slds-namespace-for-custom-hooks.js.map +7 -0
- package/build/rules/v9/no-slds-private-var.js +230 -0
- package/build/rules/v9/no-slds-private-var.js.map +7 -0
- package/build/rules/v9/no-slds-var-without-fallback.js +253 -0
- package/build/rules/v9/no-slds-var-without-fallback.js.map +7 -0
- package/build/rules/v9/no-sldshook-fallback-for-lwctoken.js +253 -0
- package/build/rules/v9/no-sldshook-fallback-for-lwctoken.js.map +7 -0
- package/build/rules/v9/no-unsupported-hooks-slds2.js +243 -0
- package/build/rules/v9/no-unsupported-hooks-slds2.js.map +7 -0
- package/build/rules/v9/reduce-annotations.js +234 -0
- package/build/rules/v9/reduce-annotations.js.map +7 -0
- package/build/src/rules/enforce-bem-usage.d.ts +17 -0
- package/build/{rules → src/rules}/modal-close-button-issue.d.ts +2 -1
- package/build/{rules → src/rules}/no-deprecated-classes-slds2.d.ts +2 -1
- package/build/src/rules/v9/enforce-bem-usage.d.ts +3 -0
- package/build/src/rules/v9/enforce-component-hook-naming-convention.d.ts +3 -0
- package/build/src/rules/v9/enforce-sds-to-slds-hooks.d.ts +3 -0
- package/build/src/rules/v9/lwc-token-to-slds-hook.d.ts +3 -0
- package/build/src/rules/v9/no-deprecated-slds-classes.d.ts +3 -0
- package/build/src/rules/v9/no-deprecated-tokens-slds1.d.ts +3 -0
- package/build/src/rules/v9/no-hardcoded-values/handlers/boxShadowHandler.d.ts +5 -0
- package/build/src/rules/v9/no-hardcoded-values/handlers/colorHandler.d.ts +7 -0
- package/build/src/rules/v9/no-hardcoded-values/handlers/densityHandler.d.ts +7 -0
- package/build/src/rules/v9/no-hardcoded-values/handlers/fontHandler.d.ts +6 -0
- package/build/src/rules/v9/no-hardcoded-values/handlers/index.d.ts +8 -0
- package/build/src/rules/v9/no-hardcoded-values/no-hardcoded-values-slds1.d.ts +3 -0
- package/build/src/rules/v9/no-hardcoded-values/no-hardcoded-values-slds2.d.ts +3 -0
- package/build/src/rules/v9/no-hardcoded-values/noHardcodedValueRule.d.ts +9 -0
- package/build/src/rules/v9/no-slds-class-overrides.d.ts +8 -0
- package/build/src/rules/v9/no-slds-namespace-for-custom-hooks.d.ts +3 -0
- package/build/src/rules/v9/no-slds-private-var.d.ts +3 -0
- package/build/src/rules/v9/no-slds-var-without-fallback.d.ts +3 -0
- package/build/src/rules/v9/no-sldshook-fallback-for-lwctoken.d.ts +3 -0
- package/build/src/rules/v9/no-unsupported-hooks-slds2.d.ts +3 -0
- package/build/src/rules/v9/reduce-annotations.d.ts +3 -0
- package/build/src/types/index.d.ts +26 -0
- package/build/src/utils/boxShadowValueParser.d.ts +17 -0
- package/build/src/utils/color-lib-utils.d.ts +18 -0
- package/build/src/utils/css-functions.d.ts +7 -0
- package/build/src/utils/css-utils.d.ts +7 -0
- package/build/src/utils/hardcoded-shared-utils.d.ts +60 -0
- package/build/src/utils/property-matcher.d.ts +23 -0
- package/build/src/utils/styling-hook-utils.d.ts +7 -0
- package/build/src/utils/value-utils.d.ts +40 -0
- package/build/types/index.js +18 -0
- package/build/types/index.js.map +7 -0
- package/build/types/yaml.d.js +1 -0
- package/build/types/yaml.d.js.map +7 -0
- package/build/utils/boxShadowValueParser.js +197 -0
- package/build/utils/boxShadowValueParser.js.map +7 -0
- package/build/utils/color-lib-utils.js +160 -0
- package/build/utils/color-lib-utils.js.map +7 -0
- package/build/utils/css-functions.js +68 -0
- package/build/utils/css-functions.js.map +7 -0
- package/build/utils/css-utils.js +33 -0
- package/build/utils/css-utils.js.map +7 -0
- package/build/utils/hardcoded-shared-utils.js +300 -0
- package/build/utils/hardcoded-shared-utils.js.map +7 -0
- package/build/utils/node.js +158 -0
- package/build/{rules/utils → utils}/node.js.map +2 -2
- package/build/utils/property-matcher.js +159 -0
- package/build/utils/property-matcher.js.map +7 -0
- package/build/utils/styling-hook-utils.js +80 -0
- package/build/utils/styling-hook-utils.js.map +7 -0
- package/build/utils/value-utils.js +65 -0
- package/build/utils/value-utils.js.map +7 -0
- package/package.json +9 -4
- package/src/config/rule-messages.yml +143 -0
- package/build/rules/enforce-bem-usage.d.ts +0 -28
- package/build/rules/utils/node.js +0 -197
- package/build/rules/utils/rule.d.ts +0 -7
- package/build/rules/utils/rule.js +0 -10
- package/build/rules/utils/rule.js.map +0 -7
- /package/build/{index.d.ts → src/index.d.ts} +0 -0
- /package/build/{rules → src}/utils/node.d.ts +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["yaml-file:/Users/ritesh.kumar2/Documents/projects/stylelint-sds/packages/eslint-plugin-slds/src/config/rule-messages.yml", "../../../src/rules/v9/lwc-token-to-slds-hook.ts"],
|
|
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-value\",\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['lwc-token-to-slds-hook'];\nconst { type, description, url, messages } = ruleConfig;\n\nconst lwcToSlds = metadata.lwcToSlds;\n\n// Replacement category enum to match Stylelint version\nenum ReplacementCategory {\n EMPTY = 'empty',\n SLDS_TOKEN = 'slds_token',\n ARRAY = 'array',\n RAW_VALUE = 'raw_value'\n}\n\nfunction shouldIgnoreDetection(lwcToken: string): boolean {\n // Ignore if entry not found in the list or the token is marked to use further\n return (\n !lwcToken.startsWith('--lwc-') ||\n !(lwcToken in lwcToSlds) ||\n lwcToSlds[lwcToken].continueToUse\n );\n}\n\nfunction categorizeReplacement(recommendation: string | string[]): ReplacementCategory {\n if (!recommendation || recommendation === '--') {\n return ReplacementCategory.EMPTY;\n }\n if (Array.isArray(recommendation)) {\n return ReplacementCategory.ARRAY;\n }\n if (typeof recommendation === 'string' && recommendation.startsWith('--slds-')) {\n return ReplacementCategory.SLDS_TOKEN;\n }\n return ReplacementCategory.RAW_VALUE;\n}\n\nfunction getRecommendation(lwcToken: string) {\n const oldValue = lwcToken;\n const recommendation = lwcToSlds[oldValue]?.replacement || '';\n const replacementCategory = categorizeReplacement(recommendation);\n const hasRecommendation = oldValue in lwcToSlds && replacementCategory !== ReplacementCategory.EMPTY;\n return { hasRecommendation, recommendation, replacementCategory };\n}\n\nfunction getReportMessage(cssVar: string, replacementCategory: ReplacementCategory, recommendation: string | string[]): { messageId: string, data: any } {\n if (!recommendation) {\n // Found a deprecated token but don't have any alternate recommendation then just report user to follow docs\n return {\n messageId: 'errorWithNoRecommendation',\n data: { oldValue: cssVar }\n };\n } else if (replacementCategory === ReplacementCategory.ARRAY) {\n return {\n messageId: 'errorWithStyleHooks',\n data: { oldValue: cssVar, newValue: (recommendation as string[]).join(' or ') }\n };\n } else if (replacementCategory === ReplacementCategory.SLDS_TOKEN) {\n return {\n messageId: 'errorWithStyleHooks',\n data: { oldValue: cssVar, newValue: recommendation as string }\n };\n } else {\n return {\n messageId: 'errorWithReplacement',\n data: { oldValue: cssVar, newValue: recommendation as string }\n };\n }\n}\n\nexport default {\n meta: {\n type,\n docs: {\n description,\n recommended: true,\n url,\n },\n fixable: 'code',\n messages,\n },\n \n create(context) {\n function reportAndFix(node, oldValue, suggestedMatch, messageId, data) {\n let fixFunction = null;\n \n // Only provide fix if we have a concrete suggestion\n if (suggestedMatch) {\n fixFunction = (fixer) => {\n // For Declaration nodes, use the offset from loc info\n if (node.type === \"Declaration\") {\n const sourceCode = context.sourceCode;\n const fullText = sourceCode.getText();\n const nodeOffset = node.loc.start.offset;\n \n // The property name appears at the start of the Declaration\n const propertyStart = nodeOffset;\n const propertyEnd = propertyStart + oldValue.length;\n \n // Verify we're replacing the right text\n const textAtPosition = fullText.substring(propertyStart, propertyEnd);\n if (textAtPosition === oldValue) {\n return fixer.replaceTextRange([propertyStart, propertyEnd], suggestedMatch);\n }\n } else {\n // For var() function replacements, we need to replace the entire function call\n const sourceCode = context.sourceCode;\n const fullText = sourceCode.getText();\n \n // Find the var() function call that contains this identifier\n const varFunctionCall = `var(${oldValue})`;\n const nodeOffset = node.loc.start.offset;\n \n // Search backwards to find the 'var(' part\n const searchStart = Math.max(0, nodeOffset - 4); // 'var('.length = 4\n const searchEnd = nodeOffset + oldValue.length + 1; // +1 for closing ')'\n const searchArea = fullText.substring(searchStart, searchEnd);\n \n const functionCallIndex = searchArea.indexOf(varFunctionCall);\n if (functionCallIndex !== -1) {\n const actualStart = searchStart + functionCallIndex;\n const actualEnd = actualStart + varFunctionCall.length;\n return fixer.replaceTextRange([actualStart, actualEnd], suggestedMatch);\n }\n }\n return null;\n };\n }\n\n context.report({\n node,\n messageId,\n data,\n fix: fixFunction\n });\n }\n\n return {\n // CSS custom property declarations: --lwc-* properties\n \"Declaration[property=/^--lwc-/]\"(node) {\n const property = node.property;\n \n if (shouldIgnoreDetection(property)) {\n return;\n }\n\n const { hasRecommendation, recommendation, replacementCategory } = getRecommendation(property);\n const { messageId, data } = getReportMessage(property, replacementCategory, recommendation);\n \n // Only provide auto-fix for SLDS token replacements\n const suggestedMatch = (hasRecommendation && replacementCategory === ReplacementCategory.SLDS_TOKEN) \n ? recommendation as string \n : null;\n \n reportAndFix(node, property, suggestedMatch, messageId, data);\n },\n\n // LWC tokens inside var() functions: var(--lwc-*)\n \"Function[name='var'] Identifier[name=/^--lwc-/]\"(node) {\n const tokenName = node.name;\n \n if (shouldIgnoreDetection(tokenName)) {\n return;\n }\n\n const { hasRecommendation, recommendation, replacementCategory } = getRecommendation(tokenName);\n const { messageId, data } = getReportMessage(tokenName, replacementCategory, recommendation);\n \n let suggestedMatch: string | null = null;\n \n if (hasRecommendation) {\n if (replacementCategory === ReplacementCategory.SLDS_TOKEN) {\n // Create the replacement in the format: var(--slds-token, var(--lwc-token))\n // This matches the Stylelint rule's behavior for SLDS tokens\n const originalVarCall = `var(${tokenName})`;\n suggestedMatch = `var(${recommendation}, ${originalVarCall})`;\n } else if (replacementCategory === ReplacementCategory.RAW_VALUE) {\n suggestedMatch = recommendation as string;\n }\n }\n\n reportAndFix(node, tokenName, suggestedMatch, messageId, data);\n },\n };\n },\n} as Rule.RuleModule;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,6HAAAA,UAAAC,SAAA;AAAA,IAAAA,QAAO,UAAU;AAAA,MACf,2BAA2B;AAAA,QACzB,eAAe;AAAA,QACf,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,YAAY;AAAA,UACV,qBAAqB;AAAA,QACvB;AAAA,MACF;AAAA,MACA,8BAA8B;AAAA,QAC5B,eAAe;AAAA,Q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EL,kCAAkC,MAAM;AACtC,cAAM,WAAW,KAAK;AAEtB,YAAI,sBAAsB,QAAQ,GAAG;AACnC;AAAA,QACF;AAEA,cAAM,EAAE,mBAAmB,gBAAgB,oBAAoB,IAAI,kBAAkB,QAAQ;AAC7F,cAAM,EAAE,WAAW,KAAK,IAAI,iBAAiB,UAAU,qBAAqB,cAAc;AAG1F,cAAM,iBAAkB,qBAAqB,wBAAwB,gCACjE,iBACA;AAEJ,qBAAa,MAAM,UAAU,gBAAgB,WAAW,IAAI;AAAA,MAC9D;AAAA;AAAA,MAGA,kDAAkD,MAAM;AACtD,cAAM,YAAY,KAAK;AAEvB,YAAI,sBAAsB,SAAS,GAAG;AACpC;AAAA,QACF;AAEA,cAAM,EAAE,mBAAmB,gBAAgB,oBAAoB,IAAI,kBAAkB,SAAS;AAC9F,cAAM,EAAE,WAAW,KAAK,IAAI,iBAAiB,WAAW,qBAAqB,cAAc;AAE3F,YAAI,iBAAgC;AAEpC,YAAI,mBAAmB;AACrB,cAAI,wBAAwB,+BAAgC;AAG1D,kBAAM,kBAAkB,OAAO,SAAS;AACxC,6BAAiB,OAAO,cAAc,KAAK,eAAe;AAAA,UAC5D,WAAW,wBAAwB,6BAA+B;AAChE,6BAAiB;AAAA,UACnB;AAAA,QACF;AAEA,qBAAa,MAAM,WAAW,gBAAgB,WAAW,IAAI;AAAA,MAC/D;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["exports", "module", "ruleMessages", "metadata"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
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
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
|
|
32
|
+
// yaml-file:/Users/ritesh.kumar2/Documents/projects/stylelint-sds/packages/eslint-plugin-slds/src/config/rule-messages.yml
|
|
33
|
+
var require_rule_messages = __commonJS({
|
|
34
|
+
"yaml-file:/Users/ritesh.kumar2/Documents/projects/stylelint-sds/packages/eslint-plugin-slds/src/config/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-value",
|
|
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
|
+
// src/rules/v9/no-deprecated-slds-classes.ts
|
|
190
|
+
var no_deprecated_slds_classes_exports = {};
|
|
191
|
+
__export(no_deprecated_slds_classes_exports, {
|
|
192
|
+
default: () => no_deprecated_slds_classes_default
|
|
193
|
+
});
|
|
194
|
+
module.exports = __toCommonJS(no_deprecated_slds_classes_exports);
|
|
195
|
+
var import_next = __toESM(require("@salesforce-ux/sds-metadata/next"));
|
|
196
|
+
var import_rule_messages = __toESM(require_rule_messages());
|
|
197
|
+
var { type, description, url, messages } = import_rule_messages.default["no-deprecated-slds-classes"];
|
|
198
|
+
var deprecatedClasses = import_next.default.deprecatedClasses;
|
|
199
|
+
var deprecatedClassesSet = new Set(deprecatedClasses);
|
|
200
|
+
var no_deprecated_slds_classes_default = {
|
|
201
|
+
meta: {
|
|
202
|
+
type,
|
|
203
|
+
docs: {
|
|
204
|
+
description,
|
|
205
|
+
recommended: true,
|
|
206
|
+
url
|
|
207
|
+
},
|
|
208
|
+
messages
|
|
209
|
+
},
|
|
210
|
+
create(context) {
|
|
211
|
+
return {
|
|
212
|
+
// For no-deprecated-slds-classes: Check all class selectors for deprecated classes
|
|
213
|
+
"SelectorList Selector ClassSelector"(node) {
|
|
214
|
+
const cssClassSelector = context.sourceCode.getText(node);
|
|
215
|
+
const className = cssClassSelector.substring(1);
|
|
216
|
+
if (className && deprecatedClassesSet.has(className)) {
|
|
217
|
+
context.report({
|
|
218
|
+
node,
|
|
219
|
+
messageId: "deprecatedClass",
|
|
220
|
+
data: { className }
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
//# sourceMappingURL=no-deprecated-slds-classes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["yaml-file:/Users/ritesh.kumar2/Documents/projects/stylelint-sds/packages/eslint-plugin-slds/src/config/rule-messages.yml", "../../../src/rules/v9/no-deprecated-slds-classes.ts"],
|
|
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-value\",\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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,6HAAAA,UAAAC,SAAA;AAAA,IAAAA,QAAO,UAAU;AAAA,MACf,2BAA2B;AAAA,QACzB,eAAe;AAAA,QACf,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,YAAY;AAAA,UACV,qBAAqB;AAAA,QACvB;AAAA,MACF;AAAA,MACA,8BAA8B;AAAA,QAC5B,eAAe;AAAA,QACf,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,YAAY;AAAA,UACV,mBAAmB;AAAA,QACrB;AAAA,MACF;AAAA,MACA,8BAA8B;AAAA,QAC5B,eAAe;AAAA,QACf,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,YAAY;AAAA,UACV,mBAAmB;AAAA,UACnB,iBAAiB;AAAA,QACnB;AAAA,MACF;AAAA,MACA,6BAA6B;AAAA,QAC3B,eAAe;AAAA,QACf,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,YAAY;AAAA,UACV,sBAAsB;AAAA,QACxB;AAAA,MACF;AAAA,MACA,qBAAqB;AAAA,QACnB,eAAe;AAAA,QACf,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,YAAY;AAAA,UACV,iBAAiB;AAAA,UACjB,gBAAgB;AAAA,QAClB;AAAA,MACF;AAAA,MACA,4BAA4B;AAAA,QAC1B,eAAe;AAAA,QACf,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,YAAY;AAAA,UACV,yBAAyB;AAAA,UACzB,eAAe;AAAA,UACf,iBAAiB;AAAA,UACjB,iBAAiB;AAAA,UACjB,uBAAuB;AAAA,UACvB,uBAAuB;AAAA,QACzB;AAAA,MACF;AAAA,MACA,+BAA+B;AAAA,QAC7B,eAAe;AAAA,QACf,OAAO;AAAA,QACP,QAAQ;A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QAC3B,eAAe;AAAA,QACf,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,YAAY;AAAA,UACV,kBAAkB;AAAA,UAClB,iBAAiB;AAAA,QACnB;AAAA,MACF;AAAA,MACA,sBAAsB;AAAA,QACpB,eAAe;AAAA,QACf,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,YAAY;AAAA,UACV,oBAAoB;AAAA,QACtB;AAAA,MACF;AAAA,IACF;AAAA;AAAA;;;ACtJA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAqB;AACrB,2BAAyB;AAEzB,IAAM,EAAC,MAAM,aAAa,KAAK,SAAQ,IAAI,qBAAAC,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": ["exports", "module", "ruleMessages", "metadata"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
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
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
|
|
32
|
+
// yaml-file:/Users/ritesh.kumar2/Documents/projects/stylelint-sds/packages/eslint-plugin-slds/src/config/rule-messages.yml
|
|
33
|
+
var require_rule_messages = __commonJS({
|
|
34
|
+
"yaml-file:/Users/ritesh.kumar2/Documents/projects/stylelint-sds/packages/eslint-plugin-slds/src/config/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-value",
|
|
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
|
+
// src/rules/v9/no-deprecated-tokens-slds1.ts
|
|
190
|
+
var no_deprecated_tokens_slds1_exports = {};
|
|
191
|
+
__export(no_deprecated_tokens_slds1_exports, {
|
|
192
|
+
default: () => no_deprecated_tokens_slds1_default
|
|
193
|
+
});
|
|
194
|
+
module.exports = __toCommonJS(no_deprecated_tokens_slds1_exports);
|
|
195
|
+
var import_next = __toESM(require("@salesforce-ux/sds-metadata/next"));
|
|
196
|
+
var import_rule_messages = __toESM(require_rule_messages());
|
|
197
|
+
var ruleConfig = import_rule_messages.default["no-deprecated-tokens-slds1"];
|
|
198
|
+
var { type, description, url, messages } = ruleConfig;
|
|
199
|
+
var tokenMapping = import_next.default.auraToLwcTokensMapping;
|
|
200
|
+
var no_deprecated_tokens_slds1_default = {
|
|
201
|
+
meta: {
|
|
202
|
+
type,
|
|
203
|
+
docs: {
|
|
204
|
+
description,
|
|
205
|
+
recommended: true,
|
|
206
|
+
url
|
|
207
|
+
},
|
|
208
|
+
fixable: "code",
|
|
209
|
+
messages
|
|
210
|
+
},
|
|
211
|
+
create(context) {
|
|
212
|
+
function shouldIgnoreDetection(token) {
|
|
213
|
+
return !(token in tokenMapping) || !tokenMapping[token].startsWith("--lwc-");
|
|
214
|
+
}
|
|
215
|
+
function generateReplacement(tokenName, originalFunctionCall) {
|
|
216
|
+
if (shouldIgnoreDetection(tokenName)) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
const recommendation = tokenMapping[tokenName];
|
|
220
|
+
return `var(${recommendation}, ${originalFunctionCall})`;
|
|
221
|
+
}
|
|
222
|
+
function handleTokenFunction(node, functionName) {
|
|
223
|
+
const tokenName = context.sourceCode.getText(node);
|
|
224
|
+
if (shouldIgnoreDetection(tokenName)) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const originalFunctionCall = `${functionName}(${tokenName})`;
|
|
228
|
+
const replacement = generateReplacement(tokenName, originalFunctionCall);
|
|
229
|
+
if (replacement) {
|
|
230
|
+
context.report({
|
|
231
|
+
node,
|
|
232
|
+
messageId: "deprecatedToken",
|
|
233
|
+
data: {
|
|
234
|
+
oldValue: originalFunctionCall,
|
|
235
|
+
newValue: replacement
|
|
236
|
+
},
|
|
237
|
+
fix(fixer) {
|
|
238
|
+
const sourceCode = context.sourceCode.getText();
|
|
239
|
+
const tokenFunctionCall = `${functionName}(${tokenName})`;
|
|
240
|
+
const nodeOffset = node.loc.start.offset;
|
|
241
|
+
const searchStart = Math.max(0, nodeOffset - functionName.length - 1);
|
|
242
|
+
const searchEnd = nodeOffset + tokenName.length + 1;
|
|
243
|
+
const searchArea = sourceCode.substring(searchStart, searchEnd);
|
|
244
|
+
const functionCallIndex = searchArea.indexOf(tokenFunctionCall);
|
|
245
|
+
if (functionCallIndex !== -1) {
|
|
246
|
+
const actualStart = searchStart + functionCallIndex;
|
|
247
|
+
const actualEnd = actualStart + tokenFunctionCall.length;
|
|
248
|
+
return fixer.replaceTextRange([actualStart, actualEnd], replacement);
|
|
249
|
+
}
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
} else {
|
|
254
|
+
context.report({
|
|
255
|
+
node,
|
|
256
|
+
messageId: "noReplacement"
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
"Function[name='token'] Identifier"(node) {
|
|
262
|
+
handleTokenFunction(node, "token");
|
|
263
|
+
},
|
|
264
|
+
"Function[name='t'] Identifier"(node) {
|
|
265
|
+
handleTokenFunction(node, "t");
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
//# sourceMappingURL=no-deprecated-tokens-slds1.js.map
|