anandthakker / doiuse

:bomb: Lint CSS for browser support against caniuse database.
MIT License
1.23k stars 50 forks source link

`mdn-text-decoration-shorthand` is incorrect and needs to be done something about it #174

Open ZhukDmitryOlegovich opened 10 months ago

ZhukDmitryOlegovich commented 10 months ago

Using doiuse in my project, I encountered the fact that when using the text-decoration rule I received an error message like mdn-text-decoration-shorthand. I read mdn about text-decoration and realized that:

  1. The check is not correct since the text-decoration property itself has been used since Chrome 1
  2. Checking in general is not necessary, since each of the text-decoration-... properties has its own separate checking rules (that's not accurate)
image

I can do a PR with the edits, but I couldn’t come to the conclusion that it’s better: remove this check altogether or fix it so that it only works on declaration like text-decoration-...: ... . What do you think?

clshortfuse commented 10 months ago

Hi! Thanks for filing the issue. Do you have a small css snippet so I can better understand the issue? Also note that we support more than what's on the MDN page going bas far as IE8 (though maybe we shouldn't).

I do see there's some overlap with

https://github.com/anandthakker/doiuse/blob/d453eeee02c4aa02b684c8887665faddf4e385bb/data/features/mdn-text-decoration-shorthand.js

and

https://github.com/anandthakker/doiuse/blob/d453eeee02c4aa02b684c8887665faddf4e385bb/data/features/text-decoration.js

ZhukDmitryOlegovich commented 10 months ago

Yes, of course, I have an example

a {
    color: inherit;
    text-decoration: none;
}

and these styles work for the browser versions listed in the first line in the screenshot, but doiuse returns an error

I can also give an example caniuse (an important clarification is that only one word-value can be passed into it, so check in file text-decoration.js on 'text-decoration': /\w \w/ seems correct to me)

And yes, I meant the check from file mdn-text-decoration-shorthand.js

ZhukDmitryOlegovich commented 9 months ago
image