-
-
Notifications
You must be signed in to change notification settings - Fork 1
Change config file to stylelint.config.js
#105
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
Conversation
|
||
function getExistingConfigInDirectory() { | ||
const explorer = cosmiconfigSync('stylelint'); | ||
async function getExistingConfigInDirectory() { | ||
const explorer = cosmiconfig('stylelint'); | ||
const result = await explorer.search(); | ||
|
||
return explorer.search(); | ||
return result; | ||
} |
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.
[Note] The sync version search
wasn't finding the stylelint.config.mjs
file. It was quicker to change to the async version than investigate why.
(I've requested a review as I don't think many people watch this repo. If you have a spare moment, please have a gander at this PR. No rush, though!) |
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.
Thanks for the PR. It looks fine, but let me submit a few reviews.
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
"optionalDependencies": { | ||
"@rollup/rollup-linux-x64-gnu": "*", | ||
"@rollup/rollup-win32-x64-msvc": "*" | ||
}, |
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.
To resolve this error on the CI:
> create-stylelint@0.5.0 test
> vitest run
D:\a\create-stylelint\create-stylelint\node_modules\rollup\dist\native.js:64
throw new Error(
^
Error: Cannot find module @rollup/rollup-win32-x64-msvc. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
Even though the bug appears to be fixed in npm (see npm/cli#8184), it was still happening for us so I've added this temp workaround.
@ybiquitous Thank you for the review. I've pushed some commits to accept your suggestions, and replied to one open query. P.S. Thanks also for handling the dependency bumps in other PRs; it makes the diff for this one cleaner. |
Co-authored-by: Gary Gozlan <Mouvedia@users.noreply.github.com>
Co-authored-by: Gary Gozlan <Mouvedia@users.noreply.github.com>
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.
Overall LGTM. I've left minor suggestions to improve visibility, but they're all optional.
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
@ybiquitous Thanks for another round of feedback. Successful output is now: ![]() Showing:
|
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.
Thank you! Sounds great to me 👍🏼
Related to #92
The related PR seems to have stalled.
I've extracted a couple of small but significant changes that were unrelated to the dry-run and package manager choice features, so that users can benefit from them now:
In our getting started guide, we advocate for using a
stylelint.config.mjs
file with a type import; the PR changes the generated config file name, format and content to align with this.To improve transparency and safety, the PR also outlines upfront what the tool will do and then uses a single prompt to ask the user if they'd like to continue. It was the most straightforward of the solutions that I came up with. Previously, the tool ran without confirmation from the user, which is atypical for init scripts.
For the outline, I've used a simple visual style (indented and dimmed text for commands and code) that I derived from other init scripts, and I've updated the next steps and error messages to match this visual style, ensuring consistency for the user. I've kept other changes to a minimum to help with the review process.
Video of changes in action:
Kapture.2025-08-12.at.12.18.04.mp4
Screenshot of an example error state:
Screenshot of
main
on success for comparison:Screenshot of
main
error for comparison:That last screenshot is a good illustration of how error messages can be confusing when we don't provide context upfront.