-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: add stylelint #464
feat: add stylelint #464
Conversation
2823c37
to
0716b08
Compare
In thinking about this, it might be better to just make this an error right away. I think all these warnings can be autofixed (we should doublecheck that). But we could do that later as well. |
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.
Tool works as expected, just one minor thing:
I just used this to add stylelint to a local dhis2 repository. When trying to check for stylelint issues, I'm getting the following warning:
../cli-style/bin/d2-style check css
css > stylelint
Error: No rules found within configuration. Have you provided a "rules" property?
at configurationError (file:///home/gerkules/development/dhis2/cli-style/node_modules/stylelint/lib/utils/configurationError.mjs:12:49)
When I add rules: []
to the .stylelintrc.js
, the warning is gone.
@@ -58,7 +58,7 @@ jobs: | |||
token: ${{secrets.DHIS2_BOT_GITHUB_TOKEN}} | |||
- uses: actions/setup-node@v2 | |||
with: | |||
node-version: 12.x | |||
node-version: 20.x |
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.
Would this need to install npm@6, just like the UI lib?
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.
As long as we don't have the peerdependency issues that ui has we shouldn't. I don't think this lib has that problem, so we should be good.
Weird, the config that this tool installs has rules, see here. It's referenced via the template that we install, here. Did you install stylelint with |
Follow up to the previous comment: I've had a horrible time on my desktop trying to get yarn link to work with our monorepo for @dhis2/cli. Eventually I gave up and went back to macos. There I could confirm that
So it should be good. Let me know. |
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.
I didn't get these issues when I actually linked the library, my bad!
There's one inconsistency: formatting the css lint issues doesn't print the files that were touched during that process, unlike what the other tools do.
Not really a problem IMO, so I approve
I double checked, it seems like only prettier outputs the files that it formatted. I've looked at whether eslint supports outputting the files that it touched with |
# [10.6.0](v10.5.2...v10.6.0) (2024-05-15) ### Features * add stylelint ([#464](#464)) ([4a8c70b](4a8c70b))
🎉 This PR is included in version 10.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
https://dhis2.atlassian.net/browse/DHIS2-16776
d2 style add stylelint
)d2 style remove stylelint
)d2 style check css
d2 style check css <filename>
d2 style check css --staged
d2 style apply css
(applies prettier and stylelint fixes)Note:
Unrelated, but for some reason the dotfiles at the root of this repo were executable. There's no need for that, so I removed it: 160c29a
Follow up: