You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using an unsupported CSS preprocessor, such as LESS CSS, the plugin defaults to interpreting the stylesheet as raw CSS. This configuration can lead to false positives with misleading error messages in ESLint violation reports.
A warning against vue-scoped-css/no-unused-selectors will pop up, with the message "The selector .foo-bar is unused."
Although it appears that the plugin is interpreting the stylesheet properly, it is in fact treating .foo and -bar as two distinct VCSSClassSelector nodes. They have no whitespace (" ") VCSSSelectorCombinator in between them, creating the misleading warning message.
The correct LESS interpretation of the above template would be .foo-bar as a single VCSSClassSelector node.
Recommendation
Rather than defaulting to the raw CSSSelectorResolver when any unrecognized stylesheet format is encountered (link to relevant code), the plugin should refrain from parsing those stylesheets altogether. Potentially, it should also log the presence of the problematic stylesheets for debugging purposes, outside of any ESLint warning/error infrastructure.
The raw CSSSelectorResolver should only be used when the lang="" attribute is not specified at all on a given <style> block.
The text was updated successfully, but these errors were encountered:
Summary
When using an unsupported CSS preprocessor, such as LESS CSS, the plugin defaults to interpreting the stylesheet as raw CSS. This configuration can lead to false positives with misleading error messages in ESLint violation reports.
Example
Given the following template:
A warning against
vue-scoped-css/no-unused-selectors
will pop up, with the message "The selector.foo-bar
is unused."Although it appears that the plugin is interpreting the stylesheet properly, it is in fact treating
.foo
and-bar
as two distinctVCSSClassSelector
nodes. They have no whitespace (" ")VCSSSelectorCombinator
in between them, creating the misleading warning message.The correct LESS interpretation of the above template would be
.foo-bar
as a singleVCSSClassSelector
node.Recommendation
Rather than defaulting to the raw
CSSSelectorResolver
when any unrecognized stylesheet format is encountered (link to relevant code), the plugin should refrain from parsing those stylesheets altogether. Potentially, it should also log the presence of the problematic stylesheets for debugging purposes, outside of any ESLint warning/error infrastructure.The raw
CSSSelectorResolver
should only be used when thelang=""
attribute is not specified at all on a given<style>
block.The text was updated successfully, but these errors were encountered: