ota-meshi / stylelint-config-recommended-vue

The recommended shareable Vue config for Stylelint.
MIT License
99 stars 5 forks source link

How to exclude code from Stylelint parsing in Vue files #74

Closed binaryfire closed 4 months ago

binaryfire commented 4 months ago

Hi @ota-meshi!

Is there a way of ignoring certain lines in Vue files? For example, it's possible to ignore code in CSS files using comments: https://stylelint.io/user-guide/ignore-code/

Stylelint sees font-size: var(--zz-text--1) in one of my Vue files as a mistake because of the -- at the end of the CSS variable name. We are using --1 because this variable representing a negative value. At the moment I've fully excluded this file, but I would prefer to just skip that one line so that I can still lint the rest of the file.

Here's a screenshot of the error: image

Thanks!

ota-meshi commented 4 months ago

We can use suppress comments in the same way in vue files as well.

https://stylelint.io/demo/#N4Igxg9gJgpiBcIA8AXGBbADgGwIZoD4AdAOyJSSgEsA3AAjDwGcmBeIkAMwgg4KQD01GsRKC0WPIVKkkTFAE9sMUQDpuEOsBkoBAKjrylMbFRIoAtNSa4ARsoskYAD0umndPQJ0WLALz8LNFdfAEZ4OlDQzGcAbh1ucwsmKj8YCJpcACcACl8AoJdLC1CASniSAF9ZASNlAhAAGi4qZQA5XHQ4RBdOnBhVGgBXOGbIEk4qAHMEEHRoIeVVF0wILJQmOlYtUjo9ug4imBIoJg4IjjqTM0txyamLLJhIdC6TmCgLYZgORt39jhZRYwM4IHYkfYA8BDeQQdAWTBZCCYGDrBQI-BoLJkMECAB6AG1cP4AAwWACcAF0ANQ5AD88AsRNJFJppT0ABIBEN-ntqlUmuAIBNpgAxNbofCzABWTEFsEwcsQ2ghBxAV3cKHOaqkIK1TX+l0Uyk1Fju02SKFwJ2yUG1HF18l+hvVxuuSXNDyeLzesE+33tIEd+tIlRAlSAA

binaryfire commented 4 months ago

@ota-meshi Great, thanks!