Skip to content

Conversation

@Mouvedia
Copy link
Member

@Mouvedia Mouvedia commented Jan 10, 2025

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

#8239

Is there anything in the PR that needs further explanation?

This PR won't touch the rules.
i.e. the erroneous messages and/or badly named parameters can be corrected in followup PRs

The medium term goal would be to flow the type to message so that it may eventually be exploited by your IDE when using js/mjs/cjs configs.
It can already be achieved through other means though.
e.g. https://github.com/search?q=repo%3Astylelint-types%2Fstylelint-define-config+message%3F&type=code

@changeset-bot
Copy link

changeset-bot bot commented Jan 10, 2025

⚠️ No Changeset found

Latest commit: b085634

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Mouvedia Mouvedia changed the title Add core rules' messages types Add messages types to core rules that pass messageArgs to report Jan 10, 2025
@Mouvedia Mouvedia requested a review from ybiquitous January 10, 2025 02:47
@Mouvedia Mouvedia force-pushed the mouvedia-crm-6 branch 2 times, most recently from b602588 to ed54f95 Compare January 10, 2025 02:58
Comment on lines -333 to -475
{
expected: (expected: string, actual: string) => string;
rejected: (keyword: string) => string;
}
Copy link
Member Author

@Mouvedia Mouvedia Jan 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

messageArgs wasn't added to rules that require for the user to check the arity.
e.g.

message: (a, b) => {
  if (typeof b === 'string') {
    /* … */
  } else { /* … */ }
}

It may be added so that #6966 can be resolved but that's out of scope for this PR.
The main rationale behind the type's addition is that it can eventually flow to message.
i.e. not for messages itself (for that we have the Messages default)

Since color-named has the arguments backward for AutofixMessage that's a blessing in disguise.

@Mouvedia Mouvedia requested a review from jeddy3 January 19, 2025 15:44
@Mouvedia

This comment was marked as resolved.

@ybiquitous

This comment was marked as resolved.

@Mouvedia Mouvedia changed the title Add messages types to core rules that pass messageArgs to report Refactor CoreRules type to add messages types to the rules that pass messageArgs to report Jan 29, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2025

This PR is packaged and the instant preview is available (b085634). View the demo website.

Install it locally:

npm i -D https://pkg.pr.new/stylelint@b085634

@Mouvedia Mouvedia changed the title Refactor CoreRules type to add messages types to the rules that pass messageArgs to report Refactor to add message types to the core rules that pass message arguments to report Jul 5, 2025
@Mouvedia
Copy link
Member Author

Mouvedia commented Jul 5, 2025

@ybiquitous I have simplified the types, please take a look when you will have the time.

@Mouvedia Mouvedia requested a review from ybiquitous July 5, 2025 13:50
@Mouvedia Mouvedia requested a review from ybiquitous July 7, 2025 19:09
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, LGTM 👍🏼

'media-feature-name-unit-allowed-list': CoreRule<
Record<string, OneOrMany<string>>,
{},
RejectedMessage<[unit: string, name: string]>
Copy link
Member Author

@Mouvedia Mouvedia Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note

should be [name: string, unit: string] but that would be a breaking change

@Mouvedia Mouvedia merged commit 0a77412 into stylelint:main Jul 8, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants