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

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...

How to Get a USA Student Visa from Bangladesh: A Step-by-Step Guide

Step-by-Step Guide to Obtaining a USA Student Visa from Bangladesh: Tips, Requirements and Application Process Get your USA student visa from Bangladesh step by step with this comprehensive guide. Learn about eligibility requirements, required documents, the application process, and tips for Bangladeshi Students  to ensure a successful visa application. Table of Contents: I. Introduction A. Overview of USA Student Visa B. Importance of USA Student Visa C. Benefits of Studying in the USA II. Eligibility Requirements A. Age Requirements B. Educational Requirements C. English Language Proficiency Requirements D. Financial Requirements III. Required Documents A. Passport B. Educational Certificates C. Proof of Financial Support D. TOEFL or IELTS Test Results E. Statement of Purpose F. Application Fee Receipt IV. Application Process A. Register for SEVIS B. Complete the Online ...

USA Visa Application Process: How Visa Officers Decide to Accept or Reject

How do USA visa officers decide to accept or reject visa applications? Understand how USA visa officers make decisions on visa applications and what you can do to increase your chances of approval. From financial support and ties to home country to documentation and interviews, this guide covers it all. Table of Contents Factors Considered in the Visa Application Process Documentation and Evidence Required Interviews and Additional Screening Common Reasons for Visa Rejection Tips for Improving Your Chances of Approval Frequently Asked Questions Factors Considered in the Visa Application Process When a visa officer reviews an application, they consider a variety of factors to determine whether the applicant is eligible for a visa. These include the applicant's: Purpose of travel Length of stay Financial status and ability to support themselves during their stay Ties to their home country and likelihood of returning after their trip Documentatio...