Skip to content
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

fix(css): remove Stylelint multiline comments from built CSS files #1935

Merged
merged 3 commits into from
Apr 5, 2023

Conversation

julien-deramond
Copy link
Member

@julien-deramond julien-deramond commented Mar 30, 2023

Related issues

#1924 (comment)

Description

Our CSS files contain multiline Stylelint comments that are useless for the end-user.

For example:

/* stylelint-disable-line function-disallowed-list */
/* stylelint-disable-line function-disallowed-list */
/* stylelint-disable-line function-disallowed-list */
/* stylelint-disable-line function-disallowed-list */
/* stylelint-disable-line function-disallowed-list */
/* stylelint-disable-line function-disallowed-list */
/* stylelint-disable-line function-disallowed-list */
/* stylelint-disable-line function-disallowed-list */
/* stylelint-disable-line function-disallowed-list */

As explained in https://sass-lang.com/documentation/syntax/comments#in-sass, multiline comments will remain when compiled by Sass and will be included in the final CSS file.

This PR removes those useless comments but also adds an automatic check to prevent them from being added again.

This check only check that the built CSS files don't contain any multiline comments starting with /* stylelint as other comments are useful like the header of the file and the RTL comments for RTLCSS.

For more context, most of them were added in when we want to disable Stylelint rules for a specific line, but also when we want to add Boosted mod comment on this same line.

So when we had the following code:

color: calc(whatever); /* stylelint-disable-line function-disallowed-list */ // Boosted mod

it must be replaced with:

// stylelint-disable-next-line function-disallowed-list
width: calc(whatever); // Boosted mod

Tasks:

Motivation & Context

Lighten the CSS files.

Types of change

  • Enhancement (non-breaking change which adds functionality)

Checklist

Contribution

Accessibility

  • (N/A) My change follows accessibility good practices; I have at least run axe

Design

  • (N/A) My change respects the design guidelines defined in Orange Design System
  • (N/A) My change is compatible with responsive display

Development

  • My change follows the developer guide
  • (N/A) I have added JavaScript unit tests to cover my changes
  • (N/A) I have added SCSS unit tests to cover my changes

Documentation

  • (N/A) My change introduces changes to the documentation and/or I have updated the documentation accordingly

Checklist (for Core Team only)

  • (N/A) My change introduces changes to the migration guide
  • (N/A) My new component is added in Storybook
  • (N/A) My new component is compatible with RTL
  • (N/A) Manually run BrowserStack tests
  • (N/A) Manually test browser compatibility with BrowserStack (Chrome >= 60, Firefox >= 60 (+ ESR), Edge, Safari >= 12, iOS Safari, Chrome & Firefox on Android)
  • (N/A) Code review
  • (N/A) Design review
  • (N/A) A11y review

After the merge

@netlify
Copy link

netlify bot commented Mar 30, 2023

Deploy Preview for boosted ready!

Name Link
🔨 Latest commit be1a1f1
🔍 Latest deploy log https://app.netlify.com/sites/boosted/deploys/642c0770198a8400094de46a
😎 Deploy Preview https://deploy-preview-1935--boosted.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@julien-deramond julien-deramond marked this pull request as ready for review March 30, 2023 14:01
@sonarcloud
Copy link

sonarcloud bot commented Apr 4, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@julien-deramond julien-deramond changed the title Remove Stylelint multiline comments from built CSS files fix(css): remove Stylelint multiline comments from built CSS files Apr 5, 2023
@julien-deramond julien-deramond merged commit 2296cac into main Apr 5, 2023
@julien-deramond julien-deramond deleted the main-jd-remove-multiline-stylelint-comments branch April 5, 2023 06:06
@julien-deramond julien-deramond mentioned this pull request Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants