[BOOKINGSG-9317][GZ] include linaria css in stylelint#1157
Conversation
| ], | ||
| "no-invalid-double-slash-comments": true, | ||
|
|
||
| // Ignore Linaria placeholder values like pcss-lin0 and -pcss-lin1. |
There was a problem hiding this comment.
not sure how this works. where are these placeholder values introduced?
There was a problem hiding this comment.
It is part of @linaria/postcss-linaria where they turn expression into those placeholders during parsing. Will take a look at the flow of having this custom sytax with stylelint
There was a problem hiding this comment.
Okay after taking a look of how stylelint works and the linaria postcss custom syntax, basically this is how it works
- File matching phase where we're looking for which files match the one where we want the syntax to be applied
- Parse phase where stylelint loads the linaria's syntax and parse it into a postcss AST. And during this phase, linaria replaced all string interpolation into those placeholders
- Validation phase where stylelint checks all the rules applied
- Fix/Stringify phase where all the fix takes place (with
--fix) and serialize the output back using the linaria's syntax stringify behavior, which replacing those placeholders back
| overrides: [ | ||
| { | ||
| /* | ||
| Taken from linaria's stylelint-config-standard-linaria package, |
There was a problem hiding this comment.
what's different from the npm linter plugin? https://github.com/callstack/linaria/blob/master/docs/LINTING.md#stylelint-14
There was a problem hiding this comment.
It should be the same, but using the one from npm keeps throwing error even when the resulted config is the same
… when wrapped by comma or parenthesis
…nd generic family
ziggyzet
left a comment
There was a problem hiding this comment.
some attributes went missing, will check the rest as well
| export const iconContainer = css` | ||
| transform: rotate(180deg); | ||
| transition: transform ${Motion["duration-250"]}${Motion["ease-default"]}; | ||
| transition: transform ${Motion["duration-250"]}; |
There was a problem hiding this comment.
uhh why was this part deleted here? is this intentional?
|
|
||
| max-height: var(${tokens.maxCollapsedHeight}); | ||
| overflow: hidden; | ||
| -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%); |
| var(${tokens.wrapper.offsetX}, 0px), | ||
| var(${tokens.wrapper.offsetY}, 0px) | ||
| ); | ||
| transform: translate(50%, -25%) translate(var(${tokens.wrapper.offsetX}), var(${tokens.wrapper.offsetY})); |
There was a problem hiding this comment.
is this change to suggest us to reinitialize the variables instead of using fallbacks?
| export const labelText = css` | ||
| ${Font["heading-sm-semibold"]} | ||
| color: ${Colour["text"]}; | ||
| word-wrap: break-word; |
There was a problem hiding this comment.
We have overflow-wrap: anywhere just below it which means the word-wrap is not being applied at all
| "lint:css": "stylelint --config stylelint.config.mjs '**/*.css' '**/*.styles.ts'", | ||
| "lint:css:fix": "stylelint --config stylelint.config.mjs '**/*.css' '**/*.styles.ts' --fix", |
There was a problem hiding this comment.
do we need to specify --config explicitly and in the vscode settings? I assumed stylelint would pick up this filename by default
There was a problem hiding this comment.
With cjs it needs the flag, but let me try with mjs
| "files": "**/*.styles.ts", | ||
| "options": { | ||
| "printWidth": 120 | ||
| } |
There was a problem hiding this comment.
This is to help us preventing the linaria's postcss which wrongly process interpolation when it is on multiple lines
f0265d0 to
820c14b
Compare
Summary
*.styles.tsfiles across NPM scripts and lint-staged.