yuschick / stylelint-plugin-defensive-css

A Stylelint plugin for enforcing defensive CSS best practices.
https://defensivecss.dev/
MIT License
139 stars 4 forks source link

Incorrect vendor prefix identification #26

Closed crstauf closed 10 months ago

crstauf commented 10 months ago

Describe the bug Error Separate different vendor prefixes into their own rules. is showing on SASS that has no vendor prefixes:

.menu-item {

    &.menu-item-has-children::after,
    &.menu-item-has-grandchildren::after {
        content: '';
        position: absolute;
        top: 24px;
        right: 30px;
        width: 18px;
        height: 18px;
        background-size: contain;
    }

}

To Reproduce Steps to reproduce the behavior:

  1. Add the SASS code above into a sass/scss file
  2. Run Stylelint with use-defensive-css plugin
  3. Notice errors

Expected behavior No vendor error(s).

Desktop (please complete the following information):

Additional context

package.json

{
  "devDependencies": {
    "stylelint": "^15.10.2",
    "stylelint-config-standard": "^34.0.0",
    "stylelint-config-standard-scss": "^11.1.0",
    "stylelint-high-performance-animation": "^1.9.0",
    "stylelint-order": "^6.0.3",
    "stylelint-plugin-defensive-css": "^0.9.1",
    "stylelint-stylistic": "^0.4.3"
  }
yuschick commented 10 months ago

Thank you for reporting this. I will dig into it as soon as I can 🤘

yuschick commented 10 months ago

@crstauf Could you share your full package file? I want to set up a project in the same way as yours to make sure I am testing correctly.

crstauf commented 10 months ago

@yuschick The package.json I shared above is the pertinent info (only other thing is a custom command).

yuschick commented 10 months ago

I'm interested in seeing how you're bringing in SCSS. I don't work with it often, so I'd like to see your project setup there, so I can make sure I am testing correctly.

crstauf commented 10 months ago

Oh. I have Dart Sass installed globally. That shouldn't impact Stylelint's review of files though, correct?

yuschick commented 10 months ago

I'm not sure off hand, but that at least gives me a place to start. From what it seems, I may need to write tests specific to SCSS. This is a bit new for me, so bare with me as I try to figure out what is needed.

yuschick commented 10 months ago

@crstauf Okay. I can recreate the error. Seems like I just need to update the RegExp I am using. Will get an update out soon.

yuschick commented 10 months ago

This has been fixed and deployed in v0.10.3.

https://github.com/yuschick/stylelint-plugin-defensive-css/pull/27

crstauf commented 10 months ago

Will check it out ASAP to confirm.

crstauf commented 10 months ago

@yuschick I ran npm update stylelint-plugin-defensive-css, and now I get some output that is not correct:

2023-12-29T000647

package.json

{
  "devDependencies": {
    "stylelint": "^15.10.2",
    "stylelint-config-standard": "^34.0.0",
    "stylelint-config-standard-scss": "^11.1.0",
    "stylelint-high-performance-animation": "^1.9.0",
    "stylelint-order": "^6.0.3",
    "stylelint-plugin-defensive-css": "0.10.3",
    "stylelint-stylistic": "^0.4.5"
  }
}
yuschick commented 10 months ago

@crstauf sorry for that! I have an idea and will update today.

yuschick commented 10 months ago

@crstauf Thanks for catching this and reporting it so quickly. I have published 0.10.4 which will no longer have those logs.

crstauf commented 10 months ago

Thanks, @yuschick! Will try it in the morning.

crstauf commented 10 months ago

Ugh, I completely forgot about this until now. Will test and report back latest by Monday.

crstauf commented 10 months ago

Managed to get to my desk tonight. Looks like it requires Stylelint 16, which not all my dependencies support yet, so I'll come back 'round once that happens.

crstauf commented 10 months ago

Updated to Stylelint 16 and v1.0.0 today: works well. Thanks!