ccbikai / stylelint-processor-html

Please Use stylelint-processor-arbitrary-tags
https://github.com/mapbox/stylelint-processor-arbitrary-tags
8 stars 3 forks source link

Unexpected empty source in HTML files without CSS #4

Open abdonrd opened 7 years ago

abdonrd commented 7 years ago

I think the process should only analyze the CSS code, and in this example I don't have any CSS code.

screen shot 2017-04-08 at 6 27 33 pm
Arcanemagus commented 7 years ago

@abdonrd You enabled a parser for HTML files so any CSS in there could be linted by stylelint, then you asked it to lint a file that has no CSS, and have now filed an issue when it complained there was no CSS in the file? It sounds like it is working exactly as it should to me.

Arcanemagus commented 7 years ago

To clarify a little bit, if you don't want to see this warning change the stylelint section of your package.json to look like this:

{
  "extends": "stylelint-config-standard",
  "processors": ["stylelint-processor-html"],
  "rules": {
    "no-empty-source": null
  }
}

This will disable the rule that is giving this error.

abdonrd commented 7 years ago

Thanks for the quick response, @Arcanemagus!

@abdonrd You enabled a parser for HTML files so any CSS in there could be linted by stylelint, then you asked it to lint a file that has no CSS, and have now filed an issue when it complained there was no CSS in the file? It sounds like it is working exactly as it should to me.

In my projects I have a lot .html files. Some of them have CSS and others don't. I think the processor should only analyze the CSS code, if it finds one.

abdonrd commented 7 years ago

To clarify a little bit, if you don't want to see this warning change the stylelint section of your package.json to look like this:

{
  "extends": "stylelint-config-standard",
  "processors": ["stylelint-processor-html"],
  "rules": {
    "no-empty-source": null
  }
}

This will disable the rule that is giving this error.

I would like keep the no-empty-source rule, because I want to avoid the empty .css files or the empty <style> tags in the .html files.

JohnRiv commented 7 years ago

I encountered the same thing as @abdonrd. In my use-case, if there is no <style> tag I'm OK with that, but if there is an empty <style> tag or an empty .css file then I'd want to be alerted on that.

I'm doing the "no-empty-source": null for now, just wanted to cast my vote for this change.

aweiu commented 6 years ago

@ccbikai 我觉得楼上说得都很有道理,大佬不准备更新一下了么。。 I think the upstairs is very reasonable, the big guy is not ready to update it?