Add `importFrom` secondary option to `no-unknown-custom-properties`
What is the problem you're trying to solve?
This issue follows up #6361.
The current implementation of the no-unknown-custom-properties rule does not support custom properties defined in other source files. In most cases, this should be inconvenient.
What solution would you like to see?
Adding the importFrom secondary option can resolve the inconvenience. However, we would need to address #4088 first.
I see this is blocked. Can we have an ignore option on no-unknown-custom-properties so I can at least list all my valid custom properties until this feature is implemented?
@dhoulb Providing an ignoreCustomProperties option sounds good. Could you please open an issue?
It'd be helpful if you could describe your motivation in detail.
A similar solution exists thanks to the csstools/stylelint-value-no-unknown-custom-properties plugin, with a importFrom option: https://github.com/csstools/stylelint-value-no-unknown-custom-properties?tab=readme-ov-file#importfrom
We should get our inspiration from this plugin to implement it on the official rule even if, as I understood reading the issues, this rule is not the only one concerned by the lack of global file import configuration.
The idea of a global css file definition on the root configuration file looks promising for that: https://github.com/stylelint/stylelint/issues/4088#issuecomment-1851939124
@Antonio-Laguna may you be interested to contribute on that feature to make it official? :slightly_smiling_face:
importFrom is something we have actually banned from our plugins and was a point of stress. This logic was repeated over and over where things were needed and became hard to test. To make things worse, some people were using it for unexpected behaviors which we didn't support.
This was removed on PostCSS Preset Env 8 completely.
We later came up with the idea of another plugin, postcss-global-data which injects into the AST all the code that might be global but it laters removes it not being processed and not producing any output.
Reading this I feel the ignore path is worth pursuing and I'd let another plugin handle the AST bit in another way that's not a concern for the no-unknown-custom-properties rule, but this is just my 2 cents here!
Thank you for sharing your experience with importForm. It reinforces that a global resolver is a better idea for us to explore. For anyone interested in improving the usefulness of this rule, please consider contributing to that issue if you have time.
I think we can close this issue in favour of https://github.com/stylelint/stylelint/issues/4088 to consolidate the discussions. We should focus on a general solution rather than add a makeshift ignore option to this rule.