Skip to content

Conversation

jeddy3
Copy link
Member

@jeddy3 jeddy3 commented Jul 31, 2025

Which issue, if any, is this issue related to?

Related to #92

Is there anything in the PR that needs further explanation?

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:

  • better alignment of the tool's behaviour with our docs
  • improved transparency and safety

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 2025-08-12 at 12 15 17

Screenshot of main on success for comparison:

Screenshot 2025-07-31 at 09 01 00

Screenshot of main error for comparison:

Screenshot 2025-07-31 at 09 01 15

That last screenshot is a good illustration of how error messages can be confusing when we don't provide context upfront.

@jeddy3 jeddy3 marked this pull request as draft July 31, 2025 08:28
@jeddy3 jeddy3 marked this pull request as ready for review July 31, 2025 08:51
Comment on lines 17 to 28

function getExistingConfigInDirectory() {
const explorer = cosmiconfigSync('stylelint');
async function getExistingConfigInDirectory() {
const explorer = cosmiconfig('stylelint');
const result = await explorer.search();

return explorer.search();
return result;
}
Copy link
Member Author

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.

@jeddy3 jeddy3 requested review from mattxwang and ybiquitous August 4, 2025 09:12
@jeddy3
Copy link
Member Author

jeddy3 commented Aug 4, 2025

(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!)

Copy link
Member

@ybiquitous ybiquitous left a 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.

jeddy3 and others added 7 commits August 14, 2025 10:41
Comment on lines 75 to 78
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "*",
"@rollup/rollup-win32-x64-msvc": "*"
},
Copy link
Member Author

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.

@jeddy3
Copy link
Member Author

jeddy3 commented Aug 14, 2025

@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.

jeddy3 and others added 4 commits August 14, 2025 17:50
Co-authored-by: Gary Gozlan <Mouvedia@users.noreply.github.com>
Co-authored-by: Gary Gozlan <Mouvedia@users.noreply.github.com>
Copy link
Member

@ybiquitous ybiquitous left a 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.

@jeddy3
Copy link
Member Author

jeddy3 commented Aug 15, 2025

@ybiquitous Thanks for another round of feedback.

Successful output is now:

Screenshot 2025-08-15 at 08 27 37

Showing:

  • the success-messages are now consistent and match the language in the starting context
  • the consistent subtle colours

Copy link
Member

@ybiquitous ybiquitous left a 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 👍🏼

@jeddy3 jeddy3 merged commit 83ec332 into main Aug 16, 2025
14 checks passed
@jeddy3 jeddy3 deleted the change-config-file branch August 16, 2025 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants