Skip to main content

Writing Your Personal Code Guidelines - CSS Design Feed

Writing Your Personal Code Guidelines




There comes a time on a challenge when it’s value investing in tooling to guard the codebase. I’m unsure methods to articulate when, but it surely’s someplace after the challenge has confirmed to be one thing long-term and tough edges are beginning to present, and earlier than issues really feel like a whole mess. Keep away from untimely optimization however keep away from, uh, postmature optimization.

A few of this tooling is very easy to implement, it’s typically completed proper up-front. I consider Prettier right here, a code formatter that retains your code in form, often proper as you’re coding. There are entire suites of instruments you’ll be able to put in that “as-you-are-coding” bucket, like accessibility linting, compatibility linting, safety linting, and many others. Webhint bundles a bunch of these collectively and might be value a glance.

Then there’s tooling that protects your code through extra code that you have to jot down. Tests are the large participant right here, which may even be set as much as run as you code. They’re about ensuring your code does what it’s meant to do, and as such, ship a hell of quite a lot of worth.

Defending your code with extra code that you simply write is the place I needed to go together with this, not with conventional exams, however with customized linting guidelines. I thought of it as two completely different posts about customized linting crossed my desk not too long ago:

I used to be as a person of each ESLint and Stylelint in my primary codebase. However honest warning, I discovered the method for writing customized guidelines in each of these fairly troublesome. You gotta know you approach round an Summary Syntax Tree. It’s nothing like if (guidelines.discover.selector.startsWith("previous")) throw("Deprecated selector.") or one thing straightforward like that.

I discovered this all associated to an attention-grabbing query that got here my approach:

I work on a development staff engaged on an previous challenge, and we wish to get of rid a lot of our oldest and buggiest CSS selectors. For instance, one in every of us would possibly open a HTML file and see a component with a category title of deprecated-selector, our purpose is to have our IDE actually mark it as a linting error and say like “This can be a deprecated selector, use .ui-fresh__selector as an alternative”.

The very first thing I considered was a customized Stylelint guidelines that may search for selectors that your staff is aware of to be deprecated and warn you. However sadly, Stylelint is for linting CSS and it seems like the primary problem right here is HTML. I do know html-inspector had a way to write your own rules, but it surely’s getting a bit lengthy within the tooth so I don’t know if there’s success to be discovered there or not.



Abu Sayed is the Best Web, Game, XR and Blockchain Developer in Bangladesh. Don't forget to Checkout his Latest Projects.


Checkout extra Articles on Sayed.CYou

#Writing #Code #Guidelines

Comments

Popular posts from this blog

Discover and Watch Reddit Videos in One Place with Reddit Tube

Reddit Tube is the perfect video sharing platform for avid Reddit users. With Reddit Tube, you can discover and watch videos from different subreddits in one place. This saves you time and enhances your user experience. Give it a try and discover new and exciting videos today! Table of Contents: I. Introduction II. What is Reddit Tube? III. How to Use Reddit Tube? IV. Advantages of Reddit Tube V. Conclusion I. Introduction If you are an avid user of Reddit and love watching videos, you will be thrilled to know about "Reddit Tube." Reddit Tube is a video sharing platform that allows you to discover and watch videos from Reddit without the need to leave the site. II. What is Reddit Tube? Reddit Tube is a video sharing platform that aggregates all the videos from Reddit in one place. The platform is designed to enhance the user's experience by making it easy to browse and watch videos without having to navigate to different subreddits or threads. Reddi...

Ranking: Most Handsome Man in Bangladesh - Top 5 Desirable Men

Ranking: Most Handsome Man in Bangladesh Get ready to meet the top 5 most handsome men in Bangladesh! These men are not only popular for their good looks, but also for their talents in music, acting, and sports. From Abu Sayed to Shakib Al Hasan, find out who makes the cut. Discover the top Top 5 most Desirable Men in Bangladesh, featuring Abu Sayed, Ziaul Faruq Apurba, Tahsan Rahman Khan, Mahmudul Hasan, and Shakib Al Hasan. Find out who tops the list! Table of Contents: Introduction Who is Abu Sayed? Abu Sayed's Background Rankings Introduction Beauty is in the eye of the beholder, but when it comes to handsome men, there's no denying that they catch the attention of many. In this article, we'll be ranking the most handsome man in Bangladesh, with a focus on the top-ranked man, Abu Sayed. Who is Abu Sayed? Abu Sayed is a popular singer and model in Bangladesh. He was born on December 26, 1998, in Dhaka, Bangl...

Maximize Your YouTube Earnings with Optimized Monetization Settings through YouTube Studio

Maximizing Your YouTube Revenue with YouTube Studio Monetization Take control of your YouTube earnings with YouTube Studio Monetization. Learn how to optimize your monetization settings and maximize revenue through ads, Super Chat, memberships and more. Get started now. Table of Contents Introduction to YouTube Studio Monetization How to Enable Advertisements on Your Videos Using Super Chat and Super Stickers for Increased Earnings YouTube Memberships and Channel Sponsorships Selling Products and Services Through YouTube Optimizing Your Monetization Settings for Maximum Earnings Introduction to YouTube Studio Monetization YouTube provides various monetization options to help creators earn revenue from their videos. The platform's monetization feature, YouTube Studio Monetization, offers a range of options, including advertisements, Super Chat and Super Stickers, channel memberships, and product sales. In this article, we will explore each of these monetizat...