feat: Implement griffel stylelint config#437
Open
ling1726 wants to merge 3 commits intomicrosoft:mainfrom
Open
feat: Implement griffel stylelint config#437ling1726 wants to merge 3 commits intomicrosoft:mainfrom
ling1726 wants to merge 3 commits intomicrosoft:mainfrom
Conversation
Implements a stylelint config for griffel that uses the postcss syntax. Also adds tests for stylelint integration.
📊 Bundle size report🤖 This report was generated against 5fdc049120a7426864edc46b1b73c91cec0ba060 |
ling1726
commented
Sep 8, 2023
| export const parse = (css: string | { toString(): string }, opts?: ParserOptions) => { | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| const { from: filename = 'postcss-syntax.styles.ts', map, ...griffelPluginOptions } = opts ?? {}; | ||
| const { from: filename = 'postcss-syntax.styles.ts', griffelPreset } = opts ?? {}; |
Contributor
Author
There was a problem hiding this comment.
postcss passes some untyped properties here - it will fail the griffel config validator, so I've put it all the preset configuration in a separate property
ling1726
commented
Sep 8, 2023
| export const stringify: postcss.Stringifier = root => { | ||
| const originalSource = root.raw(GRIFFEL_SRC_RAW); | ||
| if (originalSource) { | ||
| console.log(originalSource); |
ling1726
commented
Sep 8, 2023
| "column": 11, | ||
| "endColumn": 24, | ||
| "endLine": 5, | ||
| "line": 5, |
Contributor
Author
There was a problem hiding this comment.
The starting line is always correct, however the rest of the locations are wrong because most of the stylelint default rules calculate additional offsets internally for better reporting when linting real CSS files.
This doesn't work too well with the griffel postcss syntax since we lose the mapping to the entire style slot. Example:
That rule even uses a third party parser for the selector and doesn't really use postcss at all
layershifter
previously approved these changes
Sep 8, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements a stylelint config for griffel that uses the postcss syntax.
Also adds tests for stylelint integration.