Skip to content

rewrite-url docs: Use languageOptions in stylelint config #1587

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

Merged
merged 2 commits into from
Mar 29, 2025

Conversation

ehoogeveen-medweb
Copy link
Contributor

Now that Stylelint 16.17.0 is out with support for declaration-property-value-no-unknown in languageOptions, the suggested config for postcss-rewrite-url can be generalized. This commit makes the following changes:

  • Use languageOptions instead of overriding declaration-property-value-no-unknown rule config
  • Make syntax consistent with JSON config: Only use double quotes, no trailing commas

Preview: https://github.com/ehoogeveen-medweb/postcss-plugins/blob/rewrite-url-update-docs/plugins/postcss-rewrite-url/README.md#stylelint

I considered adding a fallback for Stylelint <16.17.0 but given that it's a minor version bump I expect people will update (and if they're looking at postcss-rewrite-url for the first time, they're probably in a good position to update stylelint anyway).

Using the JSON style for the config is a choice I don't feel strongly about - I'm still using it that way in my own projects, but here I just kept it because it seemed consistent with the quoted keys (although the markdown block is technically using language js).

* Use languageOptions instead of overriding declaration-property-value-no-unknown rule config
* Make syntax consistent with JSON config: Only use double quotes, no trailing commas
@ehoogeveen-medweb
Copy link
Contributor Author

ehoogeveen-medweb commented Mar 28, 2025

Ah, maybe the preceding text could use an update too, as it currently links to and talks about declaration-property-value-no-unknown specifically.

Also, I wonder if it would make sense to do this:

	"types": {
		"rewrite-url()": "rewrite-url( <string> <url-modifier>* )",
		"url": "| <rewrite-url()>"
	}

It might eventually help configure function-no-unknown as well, though I believe this rule doesn't support languageOptions yet.

@romainmenke
Copy link
Member

Thank you for this @ehoogeveen-medweb 🙇

I think the current change is fine for now :)
Making the type reusable is indeed better but also requires the reader to know a bit more about the syntax definitions.

Copy link
Member

@romainmenke romainmenke 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. LGTM 👍

@romainmenke romainmenke merged commit dd7c40e into csstools:main Mar 29, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants