-
Notifications
You must be signed in to change notification settings - Fork 98
EDU-15497 - CSS Analysis #2033
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
base: main
Are you sure you want to change the base?
EDU-15497 - CSS Analysis #2033
Conversation
Preview LinksOpen this URL to set up the portal with this branch changes. You can now access the edited pages with the following URLs:
|
Navigation Preview LinkNo changes detected in the navigation.json file |
Documentation feedback for docs/localization/css-analysis.mdReview of Explanation: CSS AnalysisHere's a breakdown of the feedback on the provided explanation, focusing on adherence to the given rules: 1. General FeedbackThe explanation is generally well-structured and informative. It covers the key aspects of CSS analysis within the Analyzer tool. However, there are some areas where the content can be improved to better align with the provided guidelines, particularly regarding tone, heading case, and callout formatting. 2. Actionable Feedback
3. Suggested Revision---
title:"CSS Analysis"
---
To enforce proper containment and prevent global style leakage, the Analyzer supports CSS analysis. As shown in [step 1](#instructions) of the previous section, when calling `analyzeFiles()`, you can specify CSS analysis options:
```typescript
await analyzer.analyzeFiles({
filePattern: 'your-module/**/*.{js,ts,jsx,tsx,css,less,scss}',
cssOptions: {
allowedNamespaces: ['extension-'], // Array of allowed CSS namespace prefixes
transformNonCompliant: true, // Whether to automatically fix non-compliant CSS
defaultNamespace: 'extension-', // Default namespace to add to selectors
verbose: true, // Output details and write transformed files to disk
overwriteTransformed: true, // Whether to overwrite existing transformed files
}
}); CSS rules and enforcementThe Analyzer checks for the following types of CSS violations:
Error handlingIf violations are detected and The analysis output includes:
Best practices
|
Frontmatter errors in
|
If violations are detected and `transformNonCompliant` is set to false, the Analyzer logs errors with detailed information. If set to `transformNonCompliant` true, violations are fixed automatically and logged as warnings. | ||
|
||
The analysis output includes: | ||
- Total number of files analyzed. |
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.
[markdownlint] reported by reviewdog 🐶
MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- Total number of files analyz..."]
If violations are detected and `transformNonCompliant` is set to false, the Analyzer logs errors with detailed information. If set to `transformNonCompliant` true, violations are fixed automatically and logged as warnings. | ||
|
||
The analysis output includes: | ||
- Total number of files analyzed. |
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.
[markdownlint-fix] reported by reviewdog 🐶
- Total number of files analyzed. | |
- Total number of files analyzed. |
|
||
In this guide, you'll learn how to configure and use the Analyzer to enforce CSS containment and prevent global style leakage in custom modules or extensions. CSS analysis checks for common CSS violations and ensures proper namespacing to avoid style conflicts within different parts of your application. | ||
|
||
As shown in the [Implementing FastStore Analyzer](https://developers.vtex.com/docs/guides/faststore/faststore-analyzer-implementation#instructions) guide, when calling `analyzeFiles()`, you can specify CSS analysis options: |
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.
[link-check] reported by reviewdog 🐶
🚨 Found a broken link in a Markdown Link (Error 404):
https://developers.vtex.com/docs/guides/faststore/faststore-analyzer-implementation#instructions
👉 Please review this link before merging your Pull Request.
fd49c61
to
bba71c2
Compare
207b06e
to
1315392
Compare
44809f5
to
9e4dab3
Compare
Types of changes
EDU-15497