mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-07-30 11:43:26 +08:00
1020 B
1020 B
Rule: Images
Description: Image rules for React web apps (SFDX): default to Unsplash, CSP compliance, and accessibility. Ensures Unsplash is used as the default image source unless the developer provides their own.
Applies to: force-app/main/default/webapplications/*/**/*.{js,jsx,ts,tsx,css,html}
Guidelines:
- Default to Unsplash when the user does not specify an image source; it is pre-configured in CSP and works in Salesforce without extra setup.
- Use URL format:
https://images.unsplash.com/photo-{PHOTO_ID}?w={WIDTH}&h={HEIGHT}&fit=crop&q=80&auto=format(e.g. photo ID1557683316-973673baf926). - If the user requests a different source, use it and inform: "Add CSP Trusted Site in Setup → Security → CSP Trusted Sites".
- Always add descriptive
alttext; usealt=""only for decorative images. - Avoid
placeholder.com,picsum.photos,via.placeholder.comunless requested. - CSP-approved domains:
images.unsplash.com(primary),source.unsplash.com,images.pexels.com.