-
-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#6708 - how to use images in code #6731
#6708 - how to use images in code #6731
Conversation
✅ Deploy Preview for koda-canary ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
AI-Generated Summary: This pull request addresses issue #6708, regarding the use of images in the code. It introduces changes to both the .eslintrc.js and STYLE_GUIDE.md files. In .eslintrc.js, imports have been restricted and rules updated to include components in various formats (JS, TS, VUE). Additionally, the 'no-restricted-imports' rule has been added, with a warning message advising against directly importing image files using JavaScript. Instead, the use of HTML tags and URL paths is recommended. This change has also been reflected in the STYLE_GUIDE.md, which now includes a new section on how to work with images, mandates kebab-case for image file naming and recommends the .webp format. Example codes for bad and good practice were added as well. As such, this pull request aims to enforce better practices for using images in code, enhancing readability and maintainability. |
Reviewpad Report
|
.eslintrc.js
Outdated
], | ||
rules: { | ||
'no-restricted-imports': [ | ||
'warn', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. Can we force it as an 'error'? Haha 🤣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I have updated the rule to an 'error'.
The linter will now 'ELIFECYCLE Command failed with exit code 1" if an image import is found.
files: [ | ||
'layouts/**/*.{js,ts,vue}', | ||
'pages/**/*.vue', | ||
'components/**/*.{js,ts,vue}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, need more folders, just in case
utils
, stores
, services
, plugins
, composables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following suggested directories have been added.
…rectories for image import check
Code Climate has analyzed commit c76b01a and detected 0 issues on this pull request. View more on Code Climate. |
Kudos, SonarCloud Quality Gate passed! |
pay 50 usd |
😍 Perfect, I’ve sent the payout 🪅 Let’s grab another issue and get rewarded! |
Thank you for your contribution to the KodaDot - One Stop Shop for Polkadot NFTs.
👇 __ Let's make a quick check before the contribution.
PR Type
Context
Did your issue had any of the "$" label on it?
Screenshot
Added lint warning when importing common image file types in page, layouts & component directories.
![image](https://private-user-images.githubusercontent.com/22052693/260932833-d72801bb-f998-420f-bd67-efcd681cea8a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjExNTMzNTEsIm5iZiI6MTcyMTE1MzA1MSwicGF0aCI6Ii8yMjA1MjY5My8yNjA5MzI4MzMtZDcyODAxYmItZjk5OC00MjBmLWJkNjctZWZjZDY4MWNlYThhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE2VDE4MDQxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYwZjhhOTI0MWU4MTJlMmY1Y2Y0NGEwN2NmYjY3ZTYxYmIwYzJjMDUxMmVhZjZiYjhiYzVmN2YzNmNmNjlmNGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Q0S2lPMjyWmqs8dHDtYD0p72yEVQ18VzXYbsAA7YMXQ)
Updated STYLE_GUIDE.md with new conventions as mentioned in build: reduce manifest size #6707 & Style guide: how to use images in the code #6708
![image](https://private-user-images.githubusercontent.com/22052693/260932337-9f306637-c894-4636-976d-3660b6619cfb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjExNTMzNTEsIm5iZiI6MTcyMTE1MzA1MSwicGF0aCI6Ii8yMjA1MjY5My8yNjA5MzIzMzctOWYzMDY2MzctYzg5NC00NjM2LTk3NmQtMzY2MGI2NjE5Y2ZiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE2VDE4MDQxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJkMjZmZmIxYWFiODMzY2ZjZjVkZTM5MDM2MWExNDIxOGU2MTZkYTA4NTU1YTQ0NWZjYmQzYWNkZmY0NWU4ODMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.atKvsr0bs0fa0q87_hLdxai8yVj1k3aYkRg895-aOh0)
![image](https://private-user-images.githubusercontent.com/22052693/260932934-fec14143-335a-42c8-a9cd-8ad8a1f4099f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjExNTMzNTEsIm5iZiI6MTcyMTE1MzA1MSwicGF0aCI6Ii8yMjA1MjY5My8yNjA5MzI5MzQtZmVjMTQxNDMtMzM1YS00MmM4LWE5Y2QtOGFkOGExZjQwOTlmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE2VDE4MDQxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI5N2VkYjZmOTE4MDRhYzQ1YTdkMjU3ZjU1NTAyODg4M2M4MjdiZDk3Mzc4OTM2OWM1NmJjZTMyNWYzNDgyMmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.PNVcayU98mBum4VSRc2cGT44TsX-AtDowm8m3btNGWU)
Copilot Summary
🤖 Generated by Copilot at 50d178b
This pull request enhances the style guide for image handling and adds a linting rule to enforce it. It aims to improve the performance and accessibility of the NFT gallery website by using HTML tags and URL paths for images instead of JavaScript imports.
🤖 Generated by Copilot at 50d178b