Viijay-Kr / react-ts-css

VS Code Extension for CSS modules in typescript based react projects
https://marketplace.visualstudio.com/items?itemName=viijay-kr.react-ts-css
MIT License
40 stars 4 forks source link

Support for classes within CSS `:not()` selectors #173

Closed thykka closed 1 week ago

thykka commented 2 weeks ago

Say I have a rule that only applies when a specific classname is not present:

.foo {
  /* ... */
  &:not(.active) {
    opacity: 0.5;
  }
}
import classNames from "classnames";
import styles from "./Foo.module.scss";

export const Foo = ({ isActive }: { isActive: boolean }) => {
  return (
    <div
      className={classNames({
        [styles.foo]: true,
        [styles.active]: isActive,
      })}
    >
      foo
    </div>
  );
};

Functionally, this works. We get the expected classname when isActive is true, and the corresponding styles are applied when it's not:

image

But in VS Code, we get a squiggly warning:

image

Would be nice if we didn't have to ignore these warnings with comment directives?

Viijay-Kr commented 2 weeks ago

@thykka Thanks for reporting the issue. You are absolutely right , the support for pseudo class functions should have been there.

I opened a MR to fix this 🤞🏼